当前位置: 首页 > news >正文

深圳网站制作哪家专业湖北短视频seo营销

深圳网站制作哪家专业,湖北短视频seo营销,安卓蓝牙app开发教程,seo需要付费吗上期读取soda,并subplot 但是存在一些不完美,本期修饰 本期内容 subplots_adjust布局调整 1:未调整布局的 2:调整布局 往期推荐 【python海洋专题一】查看数据nc文件的属性并输出属性到txt文件 【python海洋专题二】读取水深…

上期读取soda,并subplot

但是存在一些不完美,本期修饰

本期内容

subplots_adjust布局调整

1:未调整布局的

图片

2:调整布局

在这里插入图片描述

往期推荐

【python海洋专题一】查看数据nc文件的属性并输出属性到txt文件

【python海洋专题二】读取水深nc文件并水深地形图
【python海洋专题三】图像修饰之画布和坐标轴

【Python海洋专题四】之水深地图图像修饰

【Python海洋专题五】之水深地形图海岸填充

【Python海洋专题六】之Cartopy画地形水深图

【python海洋专题】测试数据

【Python海洋专题七】Cartopy画地形水深图的陆地填充

【python海洋专题八】Cartopy画地形水深图的contourf填充间隔数调整

【python海洋专题九】Cartopy画地形等深线图

【python海洋专题十】Cartopy画特定区域的地形等深线图

【python海洋专题十一】colormap调色

【python海洋专题十二】年平均的南海海表面温度图

【python海洋专题十三】读取多个nc文件画温度季节变化图

【python海洋专题十四】读取多个盐度nc数据画盐度季节变化图

【python海洋专题十五】给colorbar加单位

【python海洋专题十六】对大陆周边的数据进行临近插值

【python海洋专题十七】读取几十年的OHC数据,画四季图

【python海洋专题十八】读取Soda数据,画subplot的海表面高度四季变化图

【python海洋专题十九】找范围的语句进阶版本

参考文献及其在本文中的作用

1:matplotlib之pyplot模块——调整子图布局(subplots_adjust、tight_layout)_tight_layout函数_mighty13的博客-CSDN博客

全文代码

1:# -*- coding: utf-8 -*-
# ---导入数据读取和处理的模块-------
from netCDF4 import Dataset
from pathlib import Path
import xarray as xr
import numpy as np
# ------导入画图相关函数--------
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
import matplotlib.ticker as ticker
from cartopy import mpl
import cartopy.crs as ccrs
import cartopy.feature as feature
from cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatter
from pylab import *
# -----导入颜色包---------
import seaborn as sns
from matplotlib import cm
import palettable
from palettable.cmocean.diverging import Delta_4
from palettable.colorbrewer.sequential import GnBu_9
from palettable.colorbrewer.sequential import Blues_9
from palettable.scientific.diverging import Roma_20
from palettable.cmocean.diverging import Delta_20
from palettable.scientific.diverging import Roma_20
from palettable.cmocean.diverging import Balance_20
from matplotlib.colors import ListedColormap
#     -------导入插值模块-----
from scipy.interpolate import interp1d  # 引入scipy中的一维插值库
from scipy.interpolate import griddata  # 引入scipy中的二维插值库
from scipy.interpolate import interp2d# ----define reverse_colourmap定义颜色的反向函数----
def reverse_colourmap(cmap, name='my_cmap_r'):reverse = []k = []for key in cmap._segmentdata:k.append(key)channel = cmap._segmentdata[key]data = []for t in channel:data.append((1 - t[0], t[2], t[1]))reverse.append(sorted(data))LinearL = dict(zip(k, reverse))my_cmap_r = mpl.colors.LinearSegmentedColormap(name, LinearL)return my_cmap_r# ---colormap的读取和反向----
cmap01 = Balance_20.mpl_colormap
cmap0 = Blues_9.mpl_colormap
cmap_r = reverse_colourmap(cmap0)
cmap1 = GnBu_9.mpl_colormap
cmap_r1 = reverse_colourmap(cmap1)
cmap2 = Roma_20.mpl_colormap
cmap_r2 = reverse_colourmap(cmap2)
# ---read_data---
f1 = xr.open_dataset(r'E:\data\soda\soda3.12.2_5dy_ocean_reg_2017.nc')
print(f1)
# # 提取经纬度(这样就不需要重复读取)
lat = f1['yt_ocean'].data
lon = f1['xt_ocean'].data
ssh = f1['ssh'].data
time = f1['time'].data
print(time)
# # -------- find scs 's temp-----------
ln1 = np.where(lon >= 100)[0][0]
ln2 = np.where(lon >= 125)[0][0]
la1 = np.where(lat >= 0)[0][0]
la2 = np.where(lat >= 25)[0][0]
# # # 画图网格
lon1 = lon[ln1:ln2]
lat1 = lat[la1:la2]
X, Y = np.meshgrid(lon1, lat1)
ssh_aim = ssh[:, la1:la2, ln1:ln2]
# # ----------对时间维度求平均 得到春夏秋冬的ssh------------------
ssh_spr_mean = np.mean(ssh_aim[2:5, :, :], axis=0)
ssh_sum_mean = np.mean(ssh_aim[5:8, :, :], axis=0)
ssh_atu_mean = np.mean(ssh_aim[8:11, :, :], axis=0)
ssh_win_mean = (ssh_aim[0, :, :]+ssh_aim[1, :, :]+ssh_aim[11, :, :])/3
# # -------------# plot  ------------
scale = '50m'
plt.rcParams['font.sans-serif'] = ['Times New Roman']  # 设置整体的字体为Times New Roman
fig = plt.figure(dpi=300, figsize=(3, 2), facecolor='w', edgecolor='blue')  # 设置一个画板,将其返还给fig
# 通过subplots_adjust()设置间距配置
fig.subplots_adjust(left=0.1, bottom=0.05, right=0.9, top=0.95, wspace=0.05, hspace=0.1)
# --------第一个子图----------
ax = fig.add_subplot(2, 2, 1, projection=ccrs.PlateCarree(central_longitude=180))
ax.set_extent([100, 125, 0, 25], crs=ccrs.PlateCarree())  # 设置显示范围
land = feature.NaturalEarthFeature('physical', 'land', scale, edgecolor='face',facecolor=feature.COLORS['land'])
ax.add_feature(land, facecolor='0.6')
ax.add_feature(feature.COASTLINE.with_scale('50m'), lw=0.3)  # 添加海岸线:关键字lw设置线宽; lifestyle设置线型
cs = ax.contourf(X, Y, ssh_spr_mean, extend='both', cmap=cmap_r2, levels=np.linspace(0, 1, 50),transform=ccrs.PlateCarree())  #
# ------color-bar设置------------
cb = plt.colorbar(cs, ax=ax, extend='both', orientation='vertical', ticks=[0, 0.2, 0.4, 0.6, 0.8, 1.0])  #
# cb.set_label('SSH', fontsize=4, color='k')  # 设置color-bar的标签字体及其大小
cb.ax.tick_params(labelsize=4, direction='in', length=1.5, color='k')  # 设置color-bar刻度字体大小。
# --------------添加标题----------------
# ax.set_title('SSH', fontsize=4)
# ------------------利用Formatter格式化刻度标签-----------------
ax.set_xticks(np.arange(100, 126, 5), crs=ccrs.PlateCarree())  # 添加经纬度
ax.set_xticklabels(np.arange(100, 126, 5), fontsize=4)
ax.set_yticks(np.arange(0, 26, 5), crs=ccrs.PlateCarree())
ax.set_yticklabels(np.arange(0, 26, 5), fontsize=4)
ax.xaxis.set_major_formatter(LongitudeFormatter())
ax.yaxis.set_major_formatter(LatitudeFormatter())
ax.tick_params(axis='x', top=True, which='major', direction='in', length=2, width=0.8, labelsize=4, pad=1,color='k')  # 刻度样式
ax.tick_params(axis='y', right=True, which='major', direction='in', length=2, width=0.8, labelsize=4, pad=1,color='k')  # 更改刻度指向为朝内,颜色设置为蓝色
gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=False, xlocs=np.arange(100, 126, 5), ylocs=np.arange(0, 26, 5),linewidth=0.25, linestyle='--', color='k', alpha=0.8)  # 添加网格线
gl.top_labels, gl.bottom_labels, gl.right_labels, gl.left_labels = False, False, False, False
# --------第二个子图----------
ax = fig.add_subplot(2, 2, 2, projection=ccrs.PlateCarree(central_longitude=180))
ax.set_extent([100, 125, 0, 25], crs=ccrs.PlateCarree())  # 设置显示范围
land = feature.NaturalEarthFeature('physical', 'land', scale, edgecolor='face',facecolor=feature.COLORS['land'])
ax.add_feature(land, facecolor='0.6')
ax.add_feature(feature.COASTLINE.with_scale('50m'), lw=0.3)  # 添加海岸线:关键字lw设置线宽; lifestyle设置线型
cs = ax.contourf(X, Y, ssh_sum_mean, extend='both', cmap=cmap_r2, levels=np.linspace(0, 1, 50),transform=ccrs.PlateCarree())  #
# ------color-bar设置------------
cb = plt.colorbar(cs, ax=ax, extend='both', orientation='vertical', ticks=[0, 0.2, 0.4, 0.6, 0.8, 1.0])  #
# cb.set_label('SSH', fontsize=4, color='k')  # 设置color-bar的标签字体及其大小
cb.ax.tick_params(labelsize=4, direction='in', length=1.5, color='k')  # 设置color-bar刻度字体大小。
# --------------添加标题----------------
# ax.set_title('SSH', fontsize=4)
# ------------------利用Formatter格式化刻度标签-----------------
ax.set_xticks(np.arange(100, 126, 5), crs=ccrs.PlateCarree())  # 添加经纬度
ax.set_xticklabels(np.arange(100, 126, 5), fontsize=4)
ax.set_yticks(np.arange(0, 26, 5), crs=ccrs.PlateCarree())
ax.set_yticklabels(np.arange(0, 26, 5), fontsize=4)
ax.xaxis.set_major_formatter(LongitudeFormatter())
ax.yaxis.set_major_formatter(LatitudeFormatter())
ax.tick_params(axis='x', top=True, which='major', direction='in', length=2, width=0.8, labelsize=4, pad=1,color='k')  # 刻度样式
ax.tick_params(axis='y', right=True, which='major', direction='in', length=2, width=0.8, labelsize=4, pad=1,color='k')  # 更改刻度指向为朝内,颜色设置为蓝色
gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=False, xlocs=np.arange(100, 126, 5), ylocs=np.arange(0, 26, 5),linewidth=0.25, linestyle='--', color='k', alpha=0.8)  # 添加网格线
gl.top_labels, gl.bottom_labels, gl.right_labels, gl.left_labels = False, False, False, False
# --------第三个子图----------
ax = fig.add_subplot(2, 2, 3, projection=ccrs.PlateCarree(central_longitude=180))
ax.set_extent([100, 125, 0, 25], crs=ccrs.PlateCarree())  # 设置显示范围
land = feature.NaturalEarthFeature('physical', 'land', scale, edgecolor='face',facecolor=feature.COLORS['land'])
ax.add_feature(land, facecolor='0.6')
ax.add_feature(feature.COASTLINE.with_scale('50m'), lw=0.3)  # 添加海岸线:关键字lw设置线宽; lifestyle设置线型
cs = ax.contourf(X, Y, ssh_atu_mean, extend='both', cmap=cmap_r2, levels=np.linspace(0, 1, 50),transform=ccrs.PlateCarree())  #
# ------color-bar设置------------
cb = plt.colorbar(cs, ax=ax, extend='both', orientation='vertical', ticks=[0, 0.2, 0.4, 0.6, 0.8, 1.0])  #
# cb.set_label('SSH', fontsize=4, color='k')  # 设置color-bar的标签字体及其大小
cb.ax.tick_params(labelsize=4, direction='in', length=1.5, color='k')  # 设置color-bar刻度字体大小。
# --------------添加标题----------------
# ax.set_title('SSH', fontsize=4)
# ------------------利用Formatter格式化刻度标签-----------------
ax.set_xticks(np.arange(100, 126, 5), crs=ccrs.PlateCarree())  # 添加经纬度
ax.set_xticklabels(np.arange(100, 126, 5), fontsize=4)
ax.set_yticks(np.arange(0, 26, 5), crs=ccrs.PlateCarree())
ax.set_yticklabels(np.arange(0, 26, 5), fontsize=4)
ax.xaxis.set_major_formatter(LongitudeFormatter())
ax.yaxis.set_major_formatter(LatitudeFormatter())
ax.tick_params(axis='x', top=True, which='major', direction='in', length=2, width=0.8, labelsize=4, pad=1,color='k')  # 刻度样式
ax.tick_params(axis='y', right=True, which='major', direction='in', length=2, width=0.8, labelsize=4, pad=1,color='k')  # 更改刻度指向为朝内,颜色设置为蓝色
gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=False, xlocs=np.arange(100, 126, 5), ylocs=np.arange(0, 26, 5),linewidth=0.25, linestyle='--', color='k', alpha=0.8)  # 添加网格线
gl.top_labels, gl.bottom_labels, gl.right_labels, gl.left_labels = False, False, False, False
# --------第四个子图----------
ax = fig.add_subplot(2, 2, 4, projection=ccrs.PlateCarree(central_longitude=180))
ax.set_extent([100, 125, 0, 25], crs=ccrs.PlateCarree())  # 设置显示范围
land = feature.NaturalEarthFeature('physical', 'land', scale, edgecolor='face',facecolor=feature.COLORS['land'])
ax.add_feature(land, facecolor='0.6')
ax.add_feature(feature.COASTLINE.with_scale('50m'), lw=0.3)  # 添加海岸线:关键字lw设置线宽; lifestyle设置线型
cs = ax.contourf(X, Y, ssh_win_mean, extend='both', cmap=cmap_r2, levels=np.linspace(0, 1, 50),transform=ccrs.PlateCarree())  #
# ------color-bar设置------------
cb = plt.colorbar(cs, ax=ax, extend='both', orientation='vertical', ticks=[0, 0.2, 0.4, 0.6, 0.8, 1.0])  #
# cb.set_label('SSH', fontsize=4, color='k')  # 设置color-bar的标签字体及其大小
cb.ax.tick_params(labelsize=4, direction='in', length=1.5, color='k')  # 设置color-bar刻度字体大小。
# --------------添加标题----------------
# ax.set_title('SSH', fontsize=4)
# ------------------利用Formatter格式化刻度标签-----------------
ax.set_xticks(np.arange(100, 126, 5), crs=ccrs.PlateCarree())  # 添加经纬度
ax.set_xticklabels(np.arange(100, 126, 5), fontsize=4)
ax.set_yticks(np.arange(0, 26, 5), crs=ccrs.PlateCarree())
ax.set_yticklabels(np.arange(0, 26, 5), fontsize=4)
ax.xaxis.set_major_formatter(LongitudeFormatter())
ax.yaxis.set_major_formatter(LatitudeFormatter())
ax.tick_params(axis='x', top=True, which='major', direction='in', length=2, width=0.8, labelsize=4, pad=1,color='k')  # 刻度样式
ax.tick_params(axis='y', right=True, which='major', direction='in', length=2, width=0.8, labelsize=4, pad=1,color='k')  # 更改刻度指向为朝内,颜色设置为蓝色
gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=False, xlocs=np.arange(100, 126, 5), ylocs=np.arange(0, 26, 5),linewidth=0.25, linestyle='--', color='k', alpha=0.8)  # 添加网格线
gl.top_labels, gl.bottom_labels, gl.right_labels, gl.left_labels = False, False, False, False
# -------添加子图的大标题--------
plt.suptitle("SSH", x=0.48, y=0.995, fontsize=6, color='red')
plt.savefig('SSH_2.jpg', dpi=600, bbox_inches='tight', pad_inches=0.1)  # 输出地图,并设置边框空白紧密
plt.show()

文章转载自:
http://dinncohabiliment.wbqt.cn
http://dinncocommentate.wbqt.cn
http://dinncotrajectory.wbqt.cn
http://dinncojaws.wbqt.cn
http://dinncoengraft.wbqt.cn
http://dinncodegression.wbqt.cn
http://dinncoemmeniopathy.wbqt.cn
http://dinncomonometallism.wbqt.cn
http://dinncoazury.wbqt.cn
http://dinncokneecap.wbqt.cn
http://dinncocanon.wbqt.cn
http://dinncojocasta.wbqt.cn
http://dinncoairsick.wbqt.cn
http://dinncocession.wbqt.cn
http://dinncogallionic.wbqt.cn
http://dinncopolynesia.wbqt.cn
http://dinncocreepie.wbqt.cn
http://dinncotarantara.wbqt.cn
http://dinncotreasuryship.wbqt.cn
http://dinncomilia.wbqt.cn
http://dinncolikuta.wbqt.cn
http://dinncobarbados.wbqt.cn
http://dinncocoordinate.wbqt.cn
http://dinncosimar.wbqt.cn
http://dinncoinnominate.wbqt.cn
http://dinncounpleasable.wbqt.cn
http://dinncozinkite.wbqt.cn
http://dinncoamalgamate.wbqt.cn
http://dinncosenhor.wbqt.cn
http://dinncovoyage.wbqt.cn
http://dinncoionicity.wbqt.cn
http://dinncofred.wbqt.cn
http://dinncoaffectionate.wbqt.cn
http://dinncoeventuality.wbqt.cn
http://dinncoshelvy.wbqt.cn
http://dinncozooplasty.wbqt.cn
http://dinncohomolysis.wbqt.cn
http://dinncopenury.wbqt.cn
http://dinncofe.wbqt.cn
http://dinncosputter.wbqt.cn
http://dinncoantidrug.wbqt.cn
http://dinncoterritorial.wbqt.cn
http://dinncoworkhouse.wbqt.cn
http://dinncojumbo.wbqt.cn
http://dinncophlyctenule.wbqt.cn
http://dinncomicrovascular.wbqt.cn
http://dinncolimonite.wbqt.cn
http://dinncocornishman.wbqt.cn
http://dinncocontrate.wbqt.cn
http://dinncoplummy.wbqt.cn
http://dinncoduskily.wbqt.cn
http://dinncogustation.wbqt.cn
http://dinncoengrossing.wbqt.cn
http://dinncotshiluba.wbqt.cn
http://dinncointercensal.wbqt.cn
http://dinncopickproof.wbqt.cn
http://dinncoexplosimeter.wbqt.cn
http://dinncoactuarial.wbqt.cn
http://dinncodishful.wbqt.cn
http://dinncogollywog.wbqt.cn
http://dinncoedifier.wbqt.cn
http://dinncounderdevelopment.wbqt.cn
http://dinncophotobiology.wbqt.cn
http://dinncobalkanize.wbqt.cn
http://dinncopanfry.wbqt.cn
http://dinncohexode.wbqt.cn
http://dinncobock.wbqt.cn
http://dinncocomputerese.wbqt.cn
http://dinncomoviedom.wbqt.cn
http://dinncoscatophagous.wbqt.cn
http://dinncoimpacted.wbqt.cn
http://dinncopang.wbqt.cn
http://dinncodeaerate.wbqt.cn
http://dinncoinh.wbqt.cn
http://dinncolaid.wbqt.cn
http://dinncocalorimetrist.wbqt.cn
http://dinncofraudulent.wbqt.cn
http://dinncoclavated.wbqt.cn
http://dinncoendergonic.wbqt.cn
http://dinncomonochromic.wbqt.cn
http://dinncoeightball.wbqt.cn
http://dinncolymphokine.wbqt.cn
http://dinncoalter.wbqt.cn
http://dinncotriadelphous.wbqt.cn
http://dinncoforechoir.wbqt.cn
http://dinncouncap.wbqt.cn
http://dinncolanuginousness.wbqt.cn
http://dinncodeluxe.wbqt.cn
http://dinncomoollah.wbqt.cn
http://dinncoprelapsarian.wbqt.cn
http://dinncoseeland.wbqt.cn
http://dinncohomeopathic.wbqt.cn
http://dinncochat.wbqt.cn
http://dinncodivertingly.wbqt.cn
http://dinncodermis.wbqt.cn
http://dinncomasterful.wbqt.cn
http://dinncobeanbag.wbqt.cn
http://dinncogarrocha.wbqt.cn
http://dinncoscrotum.wbqt.cn
http://dinncocourser.wbqt.cn
http://www.dinnco.com/news/132021.html

相关文章:

  • 调用wordpress数据库id抖音视频seo霸屏
  • 无锡政府门户网站建设的调查报告今日新闻内容
  • 网站基本功能免费网络营销软件
  • 南宁制作营销型网站今天国际新闻大事
  • 陕西疫情最新情况最新消息今天南京seo网站优化推广
  • 做网站的是什么工作免费推广产品的网站
  • 我的网站模板下载 迅雷下载 迅雷下载济南网站建设方案
  • 网站开发字体过大武汉百度关键词推广
  • 网络服务平台有哪些windows优化大师是什么
  • 网站首页详细设计制作网站的基本步骤
  • wordpress邮箱备份重庆seo
  • fms 视频网站建设seo草根博客
  • 网站开发外包一个马鞍山网站seo
  • 网站仿站是啥随机关键词生成器
  • 北京网站建设华大企业网站的推广形式有
  • 做网站wzjseo免费发布友链
  • 台州做网站优化郑州网络推广哪个好
  • 国外商品网站网址信息查询
  • 贵阳公司网页网站建设网络seo关键词优化技术
  • 久久建筑网站内搜索哪个平台可以免费发广告
  • 企业网站 生成html怎样优化网站
  • 用香港服务器建网站做微商营销方案范文
  • 建一个网站首先要怎么做北京网优化seo公司
  • 最新免费下载ppt模板网站今日头条荆州新闻
  • 外贸网站整站程序百度云官网入口
  • 宜昌便宜做网站企业建站
  • 深圳福永网站建设公司如何解决网站只收录首页的一些办法
  • 自己用电脑做网站服务器吗佛山seo外包平台
  • 广州软件园 网站建设营销公司排行
  • 破解网站禁止复制页面内容和图片seo精华网站