【python海洋专题二十一】subplots共用一个colorbar

news2024/10/5 17:15:52

上期读取subplot,并出图

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

本期内容

共用colorbar

1:未共用colorbar

在这里插入图片描述

共用colorbar

1:横

在这里插入图片描述

2:纵

在这里插入图片描述

关键语句

图片


cb_ax = fig.add_axes([0.15, 0.02, 0.6, 0.03]) #设置colarbar位置
cbar = fig.colorbar(cs, cax=cb_ax, ax=ax, extend=‘both’, orientation=‘horizontal’, ticks=[0, 0.2, 0.4, 0.6, 0.8, 1.0]) #共享colorbar
cbar.set_label(‘SSH’, fontsize=4, color=‘k’) # 设置color-bar的标签字体及其大小cbar.ax.tick_params(labelsize=5, direction=‘in’, length=2, color=‘k’) # 设置color-bar刻度字体大小。


往期推荐

图片
【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海洋专题十九】找范围的语句进阶版本

【python海洋专题二十】subplots_adjust布局调整

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

1:Matplotlib的subplot画图, 共享colorbar - 华东博客 - 博客园 (cnblogs.com)

全文代码

# -*- 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.8, 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())  #
# ------------------利用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())  #
# ------------------利用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())  #
# ------------------利用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())  #

# ------------------利用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.44, y=0.9965, fontsize=6, color='red')
# ---------共用colorbar------
cb_ax = fig.add_axes([0.82, 0.1, 0.02, 0.8]) #设置colarbar位置
cbar = fig.colorbar(cs, cax=cb_ax, ax=ax, extend='both', orientation='vertical', ticks=[0, 0.2, 0.4, 0.6, 0.8, 1.0])     #共享colorbar
cbar.set_label('SSH', fontsize=4, color='k')  # 设置color-bar的标签字体及其大小
cbar.ax.tick_params(labelsize=5, direction='in', length=2, color='k')  # 设置color-bar刻度字体大小。
plt.savefig('SSH_1.jpg', dpi=600, bbox_inches='tight', pad_inches=0.1)  # 输出地图,并设置边框空白紧密
plt.show()
# -----坐标轴为横-------
# # -------------# 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.1, right=0.8, 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())  #
# ------------------利用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())  #
# ------------------利用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())  #
# ------------------利用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())  #

# ------------------利用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.44, y=0.9965, fontsize=6, color='red')
# ---------共用colorbar------
cb_ax = fig.add_axes([0.15, 0.02, 0.6, 0.03]) #设置colarbar位置
cbar = fig.colorbar(cs, cax=cb_ax, ax=ax, extend='both', orientation='horizontal', ticks=[0, 0.2, 0.4, 0.6, 0.8, 1.0])     #共享colorbar
cbar.set_label('SSH', fontsize=4, color='k')  # 设置color-bar的标签字体及其大小
cbar.ax.tick_params(labelsize=5, direction='in', length=2, color='k')  # 设置color-bar刻度字体大小。
plt.savefig('SSH_1.jpg', dpi=600, bbox_inches='tight', pad_inches=0.1)  # 输出地图,并设置边框空白紧密
plt.show()

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1091439.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

切换npm的版本

1、在配置环境变量的地址中,多准备几个已解压版本的node 2、要想升降版本直接更改该文件中的文件夹名称就行 环境变量中的path的值是不用变的C:\Program Files\nodejs

Leetcode 剑指 Offer II 048. 二叉树的序列化与反序列化

题目难度: 困难 原题链接 今天继续更新 Leetcode 的剑指 Offer(专项突击版)系列, 大家在公众号 算法精选 里回复 剑指offer2 就能看到该系列当前连载的所有文章了, 记得关注哦~ 题目描述 序列化是将一个数据结构或者对象转换为连续的比特位的操作&#…

商品分类代码

<!DOCTYPE html> <html> <head> <meta charset"utf-8"> <title>商品分类代码</title> <script type"text/javascript"> function MM_preloadImages() { //v3.0var ddocument; if(d.images){ if(!d.MM_p) d.MM_p…

5+甲基化+预后模型搭配实验

今天给同学们分享一篇甲基化预后模型实验的生信文章“Six immune-related promising biomarkers may promote hepatocellular carcinoma prognosis: a bioinformatics analysis and experimental validation”&#xff0c;这篇文章于2023年3月23日发表在Cancer Cell Int期刊上&…

三极管和MOS如何导通

三极管类型 原理图分析三极管&#xff0c;先看看它是什么类型&#xff0c;是PNP还是NPN。 一般通过看E极&#xff08;发射极&#xff09;流向&#xff0c;从B&#xff08;基极&#xff09;到E&#xff08;发射极&#xff09;为NPN。从E&#xff08;发射极&#xff09;到B&…

新的U-Net 网络结构

最近看到一篇很有趣的文章&#xff0c;Rethinking the unpretentious U-net for medical ultrasound image segmentation 这个文章提出了一种新的U-Net 网络结构。以前大家使用U-Net 喜欢加入新的模块或者使用多个U-Net 并联的方法进行语义分割。这篇文章提出了一种的新U-Net 结…

人工智能聊天机器人如何满足企业和客户不断变化的需求?

随着数字化转型的加速&#xff0c;企业与客户之间的沟通方式也在发生变化。传统的电话和电子邮件已经无法满足客户的即时需求和个性化体验。而人工智能聊天机器人作为一种智能助手&#xff0c;通过其快速、便捷和智能的特点&#xff0c;正在成为企业与客户之间沟通的新方式。 |…

第四章 网络层 | 计算机网络(谢希仁 第八版)

文章目录 第四章 网络层4.1 网络层提供的两种服务4.2 网际协议IP4.2.1 虚拟互连网络4.2.2 分类的IP地址4.2.3 IP地址与硬件地址4.2.4 地址解析协议ARP4.2.5 IP数据报的格式4.2.6 IP层转发分组的流程 4.3 划分子网和构造超网4.3.1 划分子网4.3.2 使用子网时分组的转发4.3.3 无分…

jwt->jwt简介,jwt工具类,jwt集进成spa项目

1.jwt简介 JWT是什么&#xff1f; JSON Web Token (JWT)&#xff0c;它是目前最流行的跨域身份验证解决方案 为什么使用JWT&#xff1f; JWT的精髓在于&#xff1a;“去中心化”&#xff0c;数据是保存在客户端的。 JWT的工作原理 1. 是在服务器身份验证之后&#xff…

【C++】C++11 ——— 可变参数模板

​ ​&#x1f4dd;个人主页&#xff1a;Sherry的成长之路 &#x1f3e0;学习社区&#xff1a;Sherry的成长之路&#xff08;个人社区&#xff09; &#x1f4d6;专栏链接&#xff1a;C学习 &#x1f3af;长路漫漫浩浩&#xff0c;万事皆有期待 上一篇博客&#xff1a;【C】STL…

《PyTorch深度学习实践》第二讲 线性模型

《PyTorch深度学习实践》第二讲 线性模型 问题描述问题分析代码实现效果课后练习 资源均来自 B站 刘二大人 &#xff0c;传送门线性模型 问题描述 问题分析 代码 import numpy as np import matplotlib.pyplot as pltx_data [1.0, 2.0, 3.0] y_data [2.0, 4.0, 6.0]# 定义模…

python+深度学习+opencv实现植物识别算法系统 计算机竞赛

0 前言 &#x1f525; 优质竞赛项目系列&#xff0c;今天要分享的是 &#x1f6a9; 基于深度学习的植物识别算法研究与实现 &#x1f947;学长这里给一个题目综合评分(每项满分5分) 难度系数&#xff1a;4分工作量&#xff1a;4分创新点&#xff1a;4分 &#x1f9ff; 更多…

js深拷贝与浅拷贝

1.浅拷贝概念 浅拷贝是其属性与拷贝源对象的属性共享相同引用&#xff0c;当你更改源或副本时&#xff0c;也可能&#xff08;可能说的是只针对引用数据类型&#xff09;导致其他对象也发生更改。 特性&#xff1a; 会新创建一个对象&#xff0c;即objobj2返回fasle&#xf…

【C++项目】高并发内存池第一讲(项目整体框架介绍、哈系统结构设计)

高并发内存池项目第一讲 一、高并内存池概念二、项目介绍三、项目细节四.哈系统结构设计 一、高并内存池概念 内存池(Memory Pool) 是一种动态内存分配与管理技术。 通常情况下&#xff0c;程序员习惯直接使用 new、delete、malloc、free 等API申请分配和释放内存&#xff0c;…

闭包及底层原理

1.闭包概念 定义&#xff1a;能够访问到其他函数作用域中的对象的函数&#xff0c;称为闭包 误区&#xff1a;闭包不是函数里面嵌套函数 2.闭包的两种写法 2.1函数嵌套写法 // 闭包写法1: 内部嵌套函数function fn(){var a 1;function fn2(){console.log(a1);}fn2();}fn()…

在线兴趣教学类线上学习APP应用开发部署程序组建研发团队需要准备什么?

哈哈哈&#xff0c;同学们&#xff0c;我又来了&#xff0c;这个问题最近问的人有点多&#xff0c;但是说实话我也不知道&#xff0c;但是我还是总结了一下&#xff0c;毕竟我懂点代码的皮毛&#xff0c;同时我检索内容的时候&#xff0c;都是一些没有很新鲜的文案&#xff0c;…

Vue中调用组件使用kebab-case(短横线)命名法和使用大驼峰的区别

文章目录 Vue中调用组件使用kebab-case&#xff08;短横线&#xff09;命名法和使用大驼峰的区别1.解析官网手册说明2.什么是“字符串模版”&#xff0c;什么是“dom模版” Vue中调用组件使用kebab-case&#xff08;短横线&#xff09;命名法和使用大驼峰的区别 1.解析官网手册…

SSM - Springboot - MyBatis-Plus 全栈体系(二十五)

第五章 SSM 三、《任务列表案例》前端程序搭建和运行 1. 整合案例介绍和接口分析 1.1 案例功能预览 1.2 接口分析 1.2.1 学习计划分页查询 /* 需求说明查询全部数据页数据 请求urischedule/{pageSize}/{currentPage} 请求方式get 响应的json{"code":200,"f…

git pull and git fetch 到底有什么区别?

大家好这里是tony4geek 。 今天给大家介绍git pull and git fetch 有什么区别&#xff1f; 开发过程中大家肯定很多人都用到过git。获取代码有很多的git命令&#xff0c;最长用的命令是pull和fetch。那么问题来了他们之间到底有什么区别&#xff0c;该怎么使用呢&#xff1f;…

C语言之文件操作篇(2)

目录 文件状态指针 文件流 文件的顺序读写 fgetc fputc fgets fputs fscanf fprintf fread fwrite 今天接下来我们讲解文件读写函数。&#x1f197;&#x1f197;&#x1f197; 文件状态指针 文件状态指针也就是文件指示器。&#xff08;可以理解为光标&#xff09…