标签:efault 坐标轴 Matter imshow auto spec orb hunk 交互模式
matplotlib.pyplot 可与 numpy 使用 (pylab已经弃用)plt.subplots(row,col) 可生成多个axesplt.draw() 如果不需要在屏幕显示,调用该函数便捷功能
线段的简化:
通过 path.simplify and path.simplify_threshold
Marker的简化:
通过markevery plt.plot(x, y, markevery=10)详情参看Markevery Demo
线分块:
mpl.rcParams[‘agg.path.chunksize‘] = 0
使用快速格式:
为了避免其他格式被改变,可以在最后部分调用,不会改变其他设置
import matplotlib.style as mplstyle
mplstyle.use(‘fast‘)
坐标轴会自动适应不同数据:线性、指数等
plot()subplot()imshow()pcolormesh() , contour()hist()matplotlib.path3D plottingstreamplot()bar()pie()table()scatter()fill()matplotlib.ticker 与 matplotlib.datessemilogx(), semilogy() 与 loglog()polar()legend()matplotlib.mathtext;useteximport matplotlib.image as mpimg ; 可以使用Pillow library, Matplotlib 只支持PNGimg = mpimg.imread(‘../../doc/_static/stinkbug.png‘)imgplot = plt.imshow(img)plt.colorbar()plt.style.use(‘fivethirtyeight‘) plt.rcParams.update({‘figure.autolayout‘: True})pyplot.setp()fig, ax = plt.subplots(figsize=(8, 4))ax.xaxis.set_major_formatter(formatter) ticker.FuncFormatterfigure.Figure.savefig()plt.style.availablempl_configdir/stylelib/presentation.mplstyleplt.style.use([‘dark_background‘, ‘presentation‘])with plt.style.context(‘dark_background‘):matplotlib.rcParams 修改格式,如 mpl.rcParams[‘lines.linewidth‘] = 2matplotlib.rc()修改格式,如 mpl.rc(‘lines‘, linewidth=4, color=‘g‘)matplotlib.rcdefaults()恢复默认配置matplotlibrc 文件中三层结构:
matplotlib.backend_bases.FigureCanvasmatplotlib.backend_bases.Rendererrenderer在canvas上绘图 matplotlib.artist.ArtistArtist 分为两类:
Line2D, Rectangle, Text, AxesImage, etcAxis, Axes and FigureAxes 通常按行列分布,使用 add_axes() 在任意位置创建axes
legend entry: 每个legend由一个或多个legend entry构成
legend key: 左边标记的颜色或模式
legend label: 描述handle的文本
legend handle: 描述的handle
处理周期数据 ps.
subplots() : 创建并布局axes
GridSpec : 重置figure布局
SubplotSpec : 给定布局,创建子图
subplot2grid() : 在grid内部创建子图
constrained_layout = ture 会避免坐标、文字重叠现象tight_layout()通过 origin 与 extent kwargs参数 控制图片的axes
绘制路径 path
设置路径艺术字效果
偏移?
设置颜色方法
(0.1, 0.2, 0.5) or (0.1, 0.2, 0.5, 0.3)#0f0f0f or #0f0f0f800.5{‘b‘, ‘g‘, ‘r‘, ‘c‘, ‘m‘, ‘y‘, ‘k‘, ‘w‘}blackxkcd:sky blueC0 根据style进行变化,数字最大也不知道是多少...(seaborn 有六种颜色 axes.prop_cycle: cycler(‘color‘, [‘4C72B0‘, ‘55A868‘, ‘C44E52‘, ‘8172B2‘, ‘CCB974‘, ‘64B5CD‘]))获取改变colormap的值;设置多个colormap
通常是线性分布,在某些情况下需要调整
选择colormap的色彩模式
基本命令
x-轴与y-轴文本的格式
标题
刻度与刻度标签
坐标转换?
非拉丁字符?
没有必要..
使用figure.Figure.savefig()保存成PDF
标签:efault 坐标轴 Matter imshow auto spec orb hunk 交互模式
原文地址:https://www.cnblogs.com/DanielOwen/p/12158934.html