plot 线型 linestyle '-'/':'/'--'/'-.'/' ' 共用坐标轴 axd["B"].set_ylim(axd["A"].get_ylim()) 自己设颜色 cmap = plt.cm.RdYlBu # define the colormap ## extract all colors from the .jet map cmaplist = [cmap(i) for i in range(cmap.N)] cn = cmap.N nhv = len(HVV) for i in range(nhv): abc=ax.plot(thv_series,HVV[i],c=cmaplist[cn//nhv*i]) 整体调整字体 parameters = {'axes.labelsize': 10, 'axes.titlesize': 35} plt.rcParams.update(parameters) 图片保存 bbox_inches=’tight’ 对坐标轴的细更改 from matplotlib.ticker import FormatStrFormatter 1. starte, ende = axd["E"].get_ylim() axd["E"].yaxis.set_ticks(np.linspace(starte, ende,6) axd["E"].yaxis.set_major_formatter(FormatStrFormatter('%.e')) 2. axd["F"].set_xlim(0,22) starte, ende = axd["F"].get_xlim() axd["F"].xaxis.set_ticks(np.arange(starte, ende,2)) axd["F"].xaxis.set_major_formatter(FormatStrFormatter('%d')) 调整坐标轴之间的间距 fig.tight_layout(w_pad=3) plt 初始化 parameters = {'axes.labelsize': 35, 标号刻度 'axes.titlesize': 35, 'xtick.labelsize': 20, x轴刻度size 'ytick.labelsize': 20, y轴刻度size 'font.sans-serif': "Arial", 'legend.fontsize': 16, 'legend.handlelength': 1.1, 'legend.shadow':0, 'legend.edgecolor':'k', 'legend.framealpha':0.90} 手动更改坐标轴 !!! 重要 ll, bb, ww, hh = axd["H"].get_position().bounds axd["H"].set_position([ll- 2 * ww, bb, ww, hh]) 颠倒图例顺序 handles, labels = axd["E"].get_legend_handles_labels() axd["E"].legend(handles[::-1],labels[::-1],fontsize=15,loc=4) 去除最后一个图例 han, lab = ax.get_legend_handles_labels() ax.legend(han[:-1], lab[:-1], loc=3 删除一个图 axd["I"].remove() 设置刻度为平均间隔 ## 设置刻度间隔 x_major_locator=MultipleLocator(30) ## 设置刻度 # axd["A"].xaxis.set_major_locator(x_major_locator) 设置确定的刻度(如台站距离) axd["A"].set_xticks(Dist,minor=False); axd["A"].set_xticklabels(stts,fontsize=10,rotation=270); 设置刻度字体大小 axd["C"].tick_params(labelsize=ftt) #刻度字体大小20 设置 log 刻度 axd["F"].set_yscale('log') 刻度是整数 from matplotlib.ticker import MaxNLocator plt.gca().xaxis.set_major_locator(MaxNLocator(integer=True)) plt.gca().yaxis.set_major_locator(MaxNLocator(integer=True))
插入域中的数字 插入->文档部件->[类别:编号]->[域名:Seq]->[域代码]:"SEQ"->"SEQ list" -> 复制 -> 更新域 也可以用代码操作如下 1. 切换域代码 Ctrl + F9 2. 加入代码({SEQ list \* MERGEFORMAT}) 3. 回复 Alt+Shift+u 加入章节号 给文章分节 布局-> 分节符 -> 下一页 插入 -> 文档部件 -> [类别:Section] -> [格式:...] -> 复制 -> 更新域 也可以用代码操作如下 1. 切换域代码 2. 加入代码({SECTION \* MERGEFORMAT} - {SEQ list \* MERGEFORMAT}) 3.对章节号进行操作 (={ SECTION }-1 \* MERGEFORMAT} - {SEQ list \* MERGEFORMAT}) 另外一些操作 对每个章节后的公式重新计数, 加入\r 更新域 F9 进入域 Shift+F9 使用短的- 如果你已经在公式编辑器中,但减号看起来仍然太长,你可以尝试以下方法: 选中减号。 然后按下键盘上的 Ctrl + Shift + -(减号键)来插入一个短的减号 Reference [1]https://www.bilibili.com/video/BV16B4y1S7Ky?share_source=copy_web [2]https://bettersolutions.com/word/fields/seq-field.htm [3]https://www.bilibili.com/video/BV1Rb4y1Z7WC/?vd_source=692865acdc6cb0c0e206b2f487199950
Matrix mulitply python a1 = np.arange(2) # [0,1] (2,) a2 = np.arange(6).reshape(2,3) # [[1,2,3][4,5,6]] (2,3) a1@a2 > array([3, 4, 5]) # (3,) a2[None,:]@b > array([[3, 4, 5]]) # (1,3) a1 * a2 >array([[0, 3], [0, 4], [0, 5]]) Q: what's the order of a a2 @ a2.T: a1 a2 @ a2.T = (a1 * a2 ) @ a2.T 实质,将系数a1平均分给a2的列向量上 Julia CPP Cholesky Decompostion The cholesky decompostion is exclusively defined for symmetric or Hermitian positive definite matrices, A = LL*. Python: 1. chol_xx_cov = np.linalg.cholesky(x_cov) 2. s1,v1,d1 = np.linalg.svd(x_cov) v1 = np.clip(v1,a_min = 1e-8,a_max = None) q1 = np.linalg.qr(np.sqrt(v1)[:,None] * d1)[-1] chol_xx_cov = q1.T Julia: CPP
Conda This is a summary about conda/jupyter commonly used commands. Installation miniconda https://mirrors.tuna.tsinghua.edu.cn/help/anaconda conda initialize conda init Create environment and packages conda create -n env_name list of packages conda create -n py python=3.3 conda create -n data python=3.5 numpy pandas For package conda install/upgrade/remove/search package_name conda upgrade --all # update all package For environment view the environment conda info --envs activate environment Linux: source/conda activate my_env Windows: active my_env deactivate environment Linux: source deactivate my_env Windows: deactivate my_env delete environment conda remove -n your_env_name --all list package conda list delete environment conda clean --packages --tarballs kernel list kernel jupyter kernelspec list delete kernel jupyter kernelspec uninstall python37564bitbasecondac521c0e867d74695b0ab483942c57dc3 add environment conda install nb_conda or pip install ipykernel python -m ipykernel install --user --name pygmt --display-name pygmt change channel channels: - https://mirrors.ustc.edu.cn/anaconda/pkgs/main/ - https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ - defaults show_channel_urls: true conda info change font conda install -n env-name -c conda-forge mscorefonts
Keypoints Public key and Private key are generated simultaneously. Private key can descrypt the messages which can be enscrypted by Public key. We can generated random nuaambers to test the consistency of the two keys. 1. symmetric encryption data encryption method whereby the same key is used to encode and decode information. 2. asymmetric encryption (public-key cryptography) Asymmetric cryptography, which can also be called public-key cryptography, uses private and public key to encrypt and decrypt the data. Public key is the one of the keys in the pair that can be shared with everyone, whereas Private key is the other key in the pair that is kept secret. Any key can be used to encrypt a message then the other key, which is not used for encryption, is used fo decryption. When the public key has been sent to the Client, the communication will be built secured. Question? How to certify the public key of the server? certifyed by the third party(CA)(http -> https). self identify. Certifyed after the first request by validating the hosts,…