知行编程网知行编程网  2022-07-20 05:00 知行编程网 隐藏边栏 |   抢沙发  1 
文章评分 0 次,平均分 0.0
<pre><p style="text-align: center;"><img class="rich_pages" data-galleryid="" data-ratio="0.4248062015503876" data-s="300,640"  data-type="png" data-w="1290" style="" src="https://www.zkxjob.com/wp-content/uploads/2022/07/wxsync-2022-07-df0b00a3f7fc67319253c9555c305875.png"  /></p>

来源丨网络

<section data-mid="" mpa-from-tpl="t" style="max-width: 100%;display: flex;justify-content: center;align-items: center;width: 677px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section data-mid="" mpa-from-tpl="t" style="max-width: 100%;display: flex;justify-content: center;align-items: center;width: 677px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><p style="max-width: 100%;min-height: 1em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><br  /></p></section></section>
大家好,我是菜鸟哥!
今天给大家介绍16个Matplotlib绘图实用的小技巧,Matplotlib在Python数据分析里有着非常广泛的使用,而且很多做科研学术的同学都是用这个库。下面整理了一些非常不错的小技巧,建议大家收藏哦!

1. 添加标题-title
matplotlib.pyplot 对象中有个 title() 可以设置表格的标题。
<section style="padding: 16px;max-width: 100%;overflow-x: auto;background-color: rgb(39, 40, 34);color: rgb(221, 221, 221);display: -webkit-box;border-radius: 0px;font-size: 12px;font-family: Consolas, Monaco, Menlo, monospace;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> numpy <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> np<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.pyplot <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> plt<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 显示中文</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.rcParams[<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'font.sans-serif'</span>] = [<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">u'SimHei'</span>]<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.rcParams[<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'axes.unicode_minus'</span>] = <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">False</strong></span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />%matplotlib inline<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />x=np.arange(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">10</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.title(<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'这是一个示例标题'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,x*x)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.show()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section>
具体实现效果:

​分享16个Matplotlib 绘图实用小技巧!


2. 添加文字-text

设置坐标和文字,可以使用 matplotlib.pyplot 对象中 text() 接口。其中 第一、二个参数来设置坐标,第三个参数是设置显示文本内容。
<section style="padding: 16px;max-width: 100%;min-height: 1em;overflow-x: auto;background-color: rgb(39, 40, 34);color: rgb(221, 221, 221);display: -webkit-box;border-radius: 0px;font-size: 12px;font-family: Consolas, Monaco, Menlo, monospace;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> numpy <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> np<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.pyplot <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> plt<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 显示中文</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.rcParams[<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'font.sans-serif'</span>] = [<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">u'SimHei'</span>]<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.rcParams[<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'axes.unicode_minus'</span>] = <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">False</strong></span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />%matplotlib inline<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />x=np.arange(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">-10</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">11</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />y=x*x<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,y)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.title(<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'这是一个示例标题'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 添加文字</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.text(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">-2.5</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">30</span>,<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'function y=x*x'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.show()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section>
具体实现效果:

​分享16个Matplotlib 绘图实用小技巧!

3. 添加注释-annotate

我们实用 annotate() 接口可以在图中增加注释说明。其中:
  • xy 参数:备注的坐标点

  • xytext 参数:备注文字的坐标(默认为xy的位置)

  • arrowprops 参数:在 xy 和 xytext 之间绘制一个箭头。

<section style="padding: 16px;max-width: 100%;overflow-x: auto;background-color: rgb(39, 40, 34);color: rgb(221, 221, 221);display: -webkit-box;border-radius: 0px;font-size: 12px;font-family: Consolas, Monaco, Menlo, monospace;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> numpy <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> np<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.pyplot <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> plt<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 显示中文</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.rcParams[<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'font.sans-serif'</span>] = [<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">u'SimHei'</span>]<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.rcParams[<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'axes.unicode_minus'</span>] = <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">False</strong></span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />%matplotlib inline<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />x=np.arange(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">-10</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">11</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />y=x*x<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.title(<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'这是一个示例标题'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,y)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 添加注释</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.annotate(<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'这是一个示例注释'</span>,xy=(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1</span>),xytext=(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">-2</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">22</span>),arrowprops={<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'headwidth'</span>:<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">10</span>,<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'facecolor'</span>:<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'r'</span>})<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.show()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section>
具体实现效果:

​分享16个Matplotlib 绘图实用小技巧!



4. 设置坐标轴名称-xlabel/ylabel

二维坐标图形中,需要在横轴和竖轴注明名称以及数量单位。设置坐标轴名称使用的接口是 xlabel() 和 ylable()。
<section style="padding: 16px;max-width: 100%;overflow-x: auto;background-color: rgb(39, 40, 34);color: rgb(221, 221, 221);display: -webkit-box;border-radius: 0px;font-size: 12px;font-family: Consolas, Monaco, Menlo, monospace;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> numpy <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> np<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.pyplot <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> plt<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 显示中文</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.rcParams[<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'font.sans-serif'</span>] = [<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">u'SimHei'</span>]<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.rcParams[<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'axes.unicode_minus'</span>] = <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">False</strong></span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />%matplotlib inline<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />x=np.arange(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">20</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.xlabel(<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'示例x轴'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.ylabel(<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'示例y轴'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,x*x)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.show()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section>
具体实现效果:

​分享16个Matplotlib 绘图实用小技巧!


5. 添加图例-legend

当线条过多时,我们设置不同颜色来区分不同线条。因此,需要对不同颜色线条做下标注,我们实用 legend() 接口来实现。
<section style="padding: 16px;max-width: 100%;overflow-x: auto;background-color: rgb(39, 40, 34);color: rgb(221, 221, 221);display: -webkit-box;border-radius: 0px;font-size: 12px;font-family: Consolas, Monaco, Menlo, monospace;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> numpy <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> np<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.pyplot <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> plt<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 显示中文</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.rcParams[<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'font.sans-serif'</span>] = [<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">u'SimHei'</span>]<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.rcParams[<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'axes.unicode_minus'</span>] = <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">False</strong></span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />%matplotlib inline<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,x)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,x*<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">2</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,x*<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">3</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,x*<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">4</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 直接传入legend</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.legend([<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'生活'</span>,<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'颜值'</span>,<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'工作'</span>,<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'金钱'</span>])<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.show()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section>
具体实现效果:

​分享16个Matplotlib 绘图实用小技巧!


6. 调整颜色-color


传颜色参数,使用 plot() 中的 color 属性来设置,color 支持以下几种方式。
<section style="padding: 16px;max-width: 100%;overflow-x: auto;background-color: rgb(39, 40, 34);color: rgb(221, 221, 221);display: -webkit-box;border-radius: 0px;font-size: 12px;font-family: Consolas, Monaco, Menlo, monospace;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> numpy <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> np<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.pyplot <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> plt<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />%matplotlib inline<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />x=np.arange(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">5</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">#颜色的几种方式</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,color=<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'g'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x+<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1</span>,color=<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'0.5'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x+<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">2</span>,color=<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'#FF00FF'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x+<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">3</span>,color=(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.1</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.2</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.3</span>))<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.show()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section>

具体实现效果:

​分享16个Matplotlib 绘图实用小技巧!



7. 切换线条样式-marker

如果想改变线条的样式,我们可以使用修改 plot() 绘图接口中 mark 参数,具体实现效果:
<section style="padding: 16px;max-width: 100%;overflow-x: auto;background-color: rgb(39, 40, 34);color: rgb(221, 221, 221);display: -webkit-box;border-radius: 0px;font-size: 12px;font-family: Consolas, Monaco, Menlo, monospace;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> numpy <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> np<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.pyplot <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> plt<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />%matplotlib inline<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />x=np.arange(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">5</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,marker=<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'o'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x+<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1</span>,marker=<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'>'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x+<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">2</span>,marker=<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'s'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.show()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section>
具体实现效果

​分享16个Matplotlib 绘图实用小技巧!

其中 marker 支持的类型:

  • ‘.’:点(point marker)

  • ‘,’:像素点(pixel marker)

  • ‘o’:圆形(circle marker)

  • ‘v’:朝下三角形(triangle_down marker)

  • ‘^’:朝上三角形(triangle_up marker)

  • ‘<‘:朝左三角形(triangle_left marker)

  • ‘>’:朝右三角形(triangle_right marker)

  • ‘1’:(tri_down marker)

  • ‘2’:(tri_up marker)

  • ‘3’:(tri_left marker)

  • ‘4’:(tri_right marker)

  • ‘s’:正方形(square marker)

  • ‘p’:五边星(pentagon marker)

  • ‘*’:星型(star marker)

  • ‘h’:1号六角形(hexagon1 marker)

  • ‘H’:2号六角形(hexagon2 marker)

  • ‘+’:+号标记(plus marker)

  • ‘x’:x号标记(x marker)

  • ‘D’:菱形(diamond marker)

  • ‘d’:小型菱形(thin_diamond marker)

  • ‘|’:垂直线形(vline marker)

  • ‘_’:水平线形(hline marker)

具体各个效果类型如下:
​分享16个Matplotlib 绘图实用小技巧!


8. 显示数学公式-mathtext

格式如下:作为开始和结束符,如$,中间的将解析出公式中的符号。
<section style="padding: 16px;max-width: 100%;overflow-x: auto;background-color: rgb(39, 40, 34);color: rgb(221, 221, 221);display: -webkit-box;border-radius: 0px;font-size: 12px;font-family: Consolas, Monaco, Menlo, monospace;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> numpy <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> np<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.pyplot <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> plt<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />%matplotlib inline<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.title(<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'chenqionghe'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.xlim([<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">8</span>])<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.ylim([<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">5</span>])<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.text(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">2</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">4</span>,<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">r'$ alpha beta pi lambda omega $'</span>,size=<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">25</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.text(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">4</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">4</span>,<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">r'$ sin(0)=cos(frac{pi}{2}) $'</span>,size=<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">25</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.text(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">2</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">2</span>,<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">r'$ lim_{x rightarrow y} frac{1}{x^3} $'</span>,size=<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">25</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.text(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">4</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">2</span>,<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">r'$ sqrt[4]{x}=sqrt{y} $'</span>,size=<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">25</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.show()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section>

具体实现效果:

​分享16个Matplotlib 绘图实用小技巧!



9. 显示网格-grid

grid() 接口可以用来设置背景图为网格。
<section style="padding: 16px;max-width: 100%;overflow-x: auto;background-color: rgb(39, 40, 34);color: rgb(221, 221, 221);display: -webkit-box;border-radius: 0px;font-size: 12px;font-family: Consolas, Monaco, Menlo, monospace;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> numpy <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> np<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.pyplot <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> plt<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />%matplotlib inline<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />x=<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'a'</span>,<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'b'</span>,<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'c'</span>,<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'d'</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />y=[<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">15</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">30</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">45</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">10</span>]<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.grid()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 也可以设置颜色、线条宽度、线条样式</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># plt.grid(color='g',linewidth='1',linestyle='-.')</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,y)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.show()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section>

具体实现效果:

​分享16个Matplotlib 绘图实用小技巧!



10. 调整坐标轴刻度-locator_params

坐标图的刻度我们可以使用 locator_params 接口来调整显示颗粒。
同时调整 x 轴和 y 轴:plt.locator_params(nbins=20)
只调整 x 轴:plt.locator_params(‘'x',nbins=20)
只调整 y 轴:plt.locator_params(‘'y',nbins=20)
<section style="padding: 16px;max-width: 100%;overflow-x: auto;background-color: rgb(39, 40, 34);color: rgb(221, 221, 221);display: -webkit-box;border-radius: 0px;font-size: 12px;font-family: Consolas, Monaco, Menlo, monospace;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> numpy <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> np<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.pyplot <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> plt<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />%matplotlib inline<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />x=np.arange(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">30</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,x)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># x轴和y轴分别显示20个</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.locator_params(nbins=<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">20</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.show()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section>
具体实现效果:

​分享16个Matplotlib 绘图实用小技巧!



11. 调整坐标轴范围-axis/xlim/ylim

axis:[0,5,0,10],x从0到5,y从0到10
xlim:对应参数有xmin和xmax,分别能调整最大值最小值
ylim:同xlim用法
<section style="padding: 16px;max-width: 100%;overflow-x: auto;background-color: rgb(39, 40, 34);color: rgb(221, 221, 221);display: -webkit-box;border-radius: 0px;font-size: 12px;font-family: Consolas, Monaco, Menlo, monospace;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> numpy <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> np<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.pyplot <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> plt<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />%matplotlib inline<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />x=np.arange(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">30</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,x*x)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">#显示坐标轴,plt.axis(),4个数字分别代表x轴和y轴的最小坐标,最大坐标</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">#调整x为10到25</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.xlim(xmin=<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">10</span>,xmax=<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">25</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,x*x)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.show()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section>
具体实现效果:

​分享16个Matplotlib 绘图实用小技巧!


12. 调整日期自适应-autofmt_xdate

有时候显示日期会重叠在一起,非常不友好,调用plt.gcf().autofmt_xdate(),将自动调整角度。
<section style="padding: 16px;max-width: 100%;overflow-x: auto;background-color: rgb(39, 40, 34);color: rgb(221, 221, 221);display: -webkit-box;border-radius: 0px;font-size: 12px;font-family: Consolas, Monaco, Menlo, monospace;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> numpy <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> np<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> pandas <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> pd<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.pyplot <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> plt<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />%matplotlib inline<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />x=pd.date_range(<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'2020/01/01'</span>,periods=<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">30</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />y=np.arange(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">30</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,y)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.gcf().autofmt_xdate()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.show()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section>
具体实现效果:

​分享16个Matplotlib 绘图实用小技巧!


13. 添加双坐标轴-twinx

<section style="padding: 16px;max-width: 100%;overflow-x: auto;background-color: rgb(39, 40, 34);color: rgb(221, 221, 221);display: -webkit-box;border-radius: 0px;font-size: 12px;font-family: Consolas, Monaco, Menlo, monospace;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> numpy <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> np<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.pyplot <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> plt<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />%matplotlib inline<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />x=np.arange(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">20</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />y1=x*x<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />y2=np.log(x)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,y1)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 添加一个坐标轴,默认0到1</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.twinx()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,y2,<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'r'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.show()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section>
具体实现效果:

​分享16个Matplotlib 绘图实用小技巧!


14. 填充区域-fill/fill_beween

fill 填充函数区域
<section style="padding: 16px;max-width: 100%;overflow-x: auto;background-color: rgb(39, 40, 34);color: rgb(221, 221, 221);display: -webkit-box;border-radius: 0px;font-size: 12px;font-family: Consolas, Monaco, Menlo, monospace;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> numpy <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> np<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.pyplot <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> plt<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 显示中文</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.rcParams[<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'font.sans-serif'</span>] = [<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">u'SimHei'</span>]<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.rcParams[<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'axes.unicode_minus'</span>] = <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">False</strong></span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />%matplotlib inline<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />x=np.linspace(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">5</span>*np.pi,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1000</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />y1=np.sin(x)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />y2=np.sin(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">2</span>*x)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,y1)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,y2)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 填充</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.fill(x,y1,<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'g'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.fill(x,y2,<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'r'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.title(<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'这是一个示例标题'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.show()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section>
具体实现效果:

​分享16个Matplotlib 绘图实用小技巧!

fill_beween填充函数交叉区域

<section style="padding: 16px;max-width: 100%;overflow-x: auto;background-color: rgb(39, 40, 34);color: rgb(221, 221, 221);display: -webkit-box;border-radius: 0px;font-size: 12px;font-family: Consolas, Monaco, Menlo, monospace;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> numpy <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> np<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.pyplot <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> plt<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 显示中文</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.rcParams[<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'font.sans-serif'</span>] = [<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">u'SimHei'</span>]<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.rcParams[<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'axes.unicode_minus'</span>] = <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">False</strong></span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />%matplotlib inline<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.title(<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'这是一个示例标题'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />x=np.linspace(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">5</span>*np.pi,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1000</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />y1=np.sin(x)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />y2=np.sin(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">2</span>*x)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,y1)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.plot(x,y2)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 填充</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.fill_between(x,y1,y2,where=y1>y2,interpolate=<span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">True</strong></span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.show()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section>
具体实现效果:

​分享16个Matplotlib 绘图实用小技巧!



15. 画一个填充好的形状-matplotlib.patche

<section style="padding: 16px;max-width: 100%;overflow-x: auto;background-color: rgb(39, 40, 34);color: rgb(221, 221, 221);display: -webkit-box;border-radius: 0px;font-size: 12px;font-family: Consolas, Monaco, Menlo, monospace;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> numpy <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> np<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.pyplot <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> plt<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.patches <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> mptaches<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />%matplotlib inline<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />xy1=np.array([<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.2</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.2</span>])<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />xy2=np.array([<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.2</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.8</span>])<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />xy3=np.array([<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.8</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.2</span>])<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />xy4=np.array([<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.8</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.8</span>])<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />fig,ax=plt.subplots()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">#圆形,指定坐标和半径</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />circle=mptaches.Circle(xy1,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.15</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />ax.add_patch(circle)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">#长方形</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />rect=mptaches.Rectangle(xy2,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.2</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.1</span>,color=<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'r'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />ax.add_patch(rect)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">#多边形</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />polygon=mptaches.RegularPolygon(xy3,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">6</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.1</span>,color=<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'g'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />ax.add_patch(polygon)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 椭圆</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />ellipse=mptaches.Ellipse(xy4,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.4</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.2</span>,color=<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'c'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />ax.add_patch(ellipse)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />ax.axis(<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'equal'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.show()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section>
具体实现效果:

​分享16个Matplotlib 绘图实用小技巧!

16. 切换样式-plt.style.use


matplotlib支持多种样式,可以通过plt.style.use切换样式,例如:
plt.style.use('ggplot')输入plt.style.available 可以查看所有的样式:
<section style="padding: 16px;max-width: 100%;overflow-x: auto;background-color: rgb(39, 40, 34);color: rgb(221, 221, 221);display: -webkit-box;border-radius: 0px;font-size: 12px;font-family: Consolas, Monaco, Menlo, monospace;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.pyplot <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> plt<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.style.available<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section>
具体实现效果:

​分享16个Matplotlib 绘图实用小技巧!

示例代码,ggplot样式:
<section style="padding: 16px;max-width: 100%;overflow-x: auto;background-color: rgb(39, 40, 34);color: rgb(221, 221, 221);display: -webkit-box;border-radius: 0px;font-size: 12px;font-family: Consolas, Monaco, Menlo, monospace;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> numpy <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> np<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.pyplot <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> plt<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">import</strong></span> matplotlib.patches <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">as</strong></span> mptaches<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />%matplotlib inline<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.style.use(<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'ggplot'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 新建4个子图</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />fig,axes=plt.subplots(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">2</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">2</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />ax1,ax2,ax3,ax4=axes.ravel()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 第一个图</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />x,y=np.random.normal(size=(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">2</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">100</span>))<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />ax1.plot(x,y,<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'o'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 第二个图</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />x=np.arange(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">10</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />y=np.arange(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">10</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />colors=plt.rcParams[<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'axes.prop_cycle'</span>]<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />length=np.linspace(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">10</span>,len(colors))<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">for</strong></span> s <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">in</strong></span> length:<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />    ax2.plot(x,y+s,<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'-'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 第三个图</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />x=np.arange(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">5</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />y1,y2,y3=np.random.randint(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">25</span>,size=(<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">3</span>,<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">5</span>))<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />width=<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.25</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />ax3.bar(x,y1,width)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />ax3.bar(x+width,y2,width)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />ax3.bar(x+<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">2</span>*width,y3,width)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(117, 113, 94);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"># 第四个图</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /><span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">for</strong></span> i,color <span style="max-width: 100%;color: rgb(249, 38, 114);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;">in</strong></span> enumerate(colors):<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />    xy=np.random.normal(size=<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">2</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />ax4.add_patch(plt.Circle(xy,radius=<span style="max-width: 100%;line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">0.3</span>,color=color[<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'color'</span>]))<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />ax4.axis(<span style="max-width: 100%;color: rgb(166, 226, 46);line-height: 26px;box-sizing: border-box !important;overflow-wrap: break-word !important;">'equal'</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  />plt.show()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section>
具体实现效果:
​分享16个Matplotlib 绘图实用小技巧!



<section style="letter-spacing: 0px;white-space: normal;color: rgb(0, 0, 0);text-align: left;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;line-height: 1.5em;"><br  /></section><p style="letter-spacing: 0px;white-space: normal;color: rgb(0, 0, 0);text-align: left;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;line-height: 2em;"><strong><span style="color: rgb(53, 53, 53);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;font-size: 16px;letter-spacing: 0.8px;text-align: left;word-spacing: 0.8px;">最后推荐一下我们的星球:由菜鸟学Python原班人马建了一个投资星球,汇聚一批喜欢投资的朋友一起分享投资的技巧,不限于基金,股票等其他品种,提高自己的财商,一起读书打卡,欢迎加入。</span></strong></p><section style="letter-spacing: 0px;white-space: normal;color: rgb(0, 0, 0);text-align: left;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;line-height: 1.5em;"><span style="color: rgb(53, 53, 53);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;font-size: 16px;letter-spacing: 0.8px;text-align: left;word-spacing: 0.8px;"><br  /></span></section><p style="text-align: center;"><img class="rich_pages" data-galleryid="" data-ratio="0.5493333333333333" data-s="300,640"  data-type="jpeg" data-w="1125" style="width: 363px;height: 199px;" src="https://www.zkxjob.com/wp-content/uploads/2022/07/wxsync-2022-07-0f07e4dcca1be48ac449e6ee767e8990.jpeg"  /></p><section style="letter-spacing: 0px;white-space: normal;color: rgb(0, 0, 0);text-align: left;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;line-height: 1.5em;"><span style="color: rgb(53, 53, 53);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;font-size: 16px;letter-spacing: 0.8px;text-align: left;word-spacing: 0.8px;"></span><br  /></section><p><br  /></p><section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="padding: 10px;max-width: 100%;color: black;line-height: 1.6;letter-spacing: 0px;word-break: break-word;text-align: left;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><pre style="max-width: 100%;font-size: 16px;font-weight: 700;letter-spacing: 0.544px;widows: 1;word-spacing: 1px;caret-color: rgb(51, 51, 51);color: rgb(63, 63, 63);line-height: inherit;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section data-role="outer" label="Powered by 135editor.com" data-darkmode-bgcolor="rgb(36, 36, 36)" data-darkmode-original-bgcolor="rgb(255, 255, 255)" data-darkmode-color="rgb(168, 168, 168)" data-darkmode-original-color="rgb(62, 62, 62)" data-style="max-width: 100%; font-family: -apple-system-font, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif; font-size: 16px; letter-spacing: 0.544px; white-space: normal; background-color: rgb(255, 255, 255); color: rgb(62, 62, 62); text-align: left; box-sizing: border-box !important; overflow-wrap: break-word !important;" style="max-width: 100%;font-family: -apple-system-font, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;color: rgb(62, 62, 62);box-sizing: border-box !important;overflow-wrap: break-word !important;"><section data-role="outer" label="Powered by 135editor.com" data-mpa-powered-by="yiban.io" style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><pre style="max-width: 100%;letter-spacing: 0.544px;font-size: 15px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section data-role="outer" label="Powered by 135editor.com" style="max-width: 100%;letter-spacing: 0.544px;white-space: normal;font-size: 16px;font-family: 微软雅黑, "Helvetica Nue", sans-serif;word-spacing: 1.6px;text-align: center;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="max-width: 100%;line-height: 1.6;letter-spacing: 0px;font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;box-sizing: border-box !important;overflow-wrap: break-word !important;"><pre data-darkmode-bgcolor="rgb(36, 36, 36)" data-style="background-color: rgb(255, 255, 255); color: rgba(230, 230, 230, 0.9); letter-spacing: 0.544px; text-size-adjust: auto; font-size: 16px; text-align: center; word-spacing: 1.6px;" data-darkmode-color="rgba(230, 230, 230, 0.9)" data-darkmode-original-color="rgba(230, 230, 230, 0.9)" data-darkmode-original-bgcolor="rgb(255, 255, 255)" data-darkmode-bgcolor-15862411819306="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15862411819306="rgb(255, 255, 255)" data-darkmode-color-15862411819306="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15862411819306="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-15862671987026="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15862671987026="rgb(255, 255, 255)" data-darkmode-color-15862671987026="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15862671987026="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-15864118999603="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15864118999603="rgb(255, 255, 255)" data-darkmode-color-15864118999603="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15864118999603="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-15864940858736="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15864940858736="rgb(255, 255, 255)" data-darkmode-color-15864940858736="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15864940858736="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-15869584691402="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15869584691402="rgb(255, 255, 255)" data-darkmode-color-15869584691402="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15869584691402="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-15869584691739="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15869584691739="rgb(255, 255, 255)" data-darkmode-color-15869584691739="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15869584691739="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-15873005456075="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15873005456075="rgb(255, 255, 255)" data-darkmode-color-15873005456075="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15873005456075="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-15873005456615="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15873005456615="rgb(255, 255, 255)" data-darkmode-color-15873005456615="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15873005456615="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-15886839320558="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15886839320558="rgb(255, 255, 255)" data-darkmode-color-15886839320558="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15886839320558="rgba(230, 230, 230, 0.9)" data-darkmode-color-159923607914210="rgba(163, 163, 163, 0.9)" data-darkmode-original-color-159923607914210="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-159923607914210="rgb(25, 25, 25)" data-darkmode-original-bgcolor-159923607914210="rgb(255, 255, 255)" data-darkmode-bgcolor-160008070860010="rgb(25, 25, 25)" data-darkmode-original-bgcolor-160008070860010="rgb(255, 255, 255)" data-darkmode-color-160008070860010="rgba(163, 163, 163, 0.9)" data-darkmode-original-color-160008070860010="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-16072664870629="rgb(25, 25, 25)" data-darkmode-original-bgcolor-16072664870629="rgb(255, 255, 255)" data-darkmode-color-16072664870629="rgba(163, 163, 163, 0.9)" data-darkmode-original-color-16072664870629="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-16073544711184="rgb(25, 25, 25)" data-darkmode-original-bgcolor-16073544711184="rgb(255, 255, 255)" data-darkmode-color-16073544711184="rgba(163, 163, 163, 0.9)" data-darkmode-original-color-16073544711184="rgba(230, 230, 230, 0.9)" style="max-width: 100%;letter-spacing: 0.544px;word-spacing: 1.6px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><pre data-darkmode-bgcolor="rgb(36, 36, 36)" data-style="background-color: rgb(255, 255, 255); color: rgba(230, 230, 230, 0.9); letter-spacing: 0.544px; text-size-adjust: auto; font-size: 16px; text-align: center; word-spacing: 1.6px;" data-darkmode-color="rgba(230, 230, 230, 0.9)" data-darkmode-original-color="rgba(230, 230, 230, 0.9)" data-darkmode-original-bgcolor="rgb(255, 255, 255)" data-darkmode-bgcolor-15862411819306="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15862411819306="rgb(255, 255, 255)" data-darkmode-color-15862411819306="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15862411819306="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-15862671987026="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15862671987026="rgb(255, 255, 255)" data-darkmode-color-15862671987026="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15862671987026="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-15864118999603="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15864118999603="rgb(255, 255, 255)" data-darkmode-color-15864118999603="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15864118999603="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-15864940858736="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15864940858736="rgb(255, 255, 255)" data-darkmode-color-15864940858736="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15864940858736="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-15869584691402="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15869584691402="rgb(255, 255, 255)" data-darkmode-color-15869584691402="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15869584691402="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-15869584691739="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15869584691739="rgb(255, 255, 255)" data-darkmode-color-15869584691739="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15869584691739="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-15873005456075="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15873005456075="rgb(255, 255, 255)" data-darkmode-color-15873005456075="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15873005456075="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-15873005456615="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15873005456615="rgb(255, 255, 255)" data-darkmode-color-15873005456615="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15873005456615="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-15886839320558="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15886839320558="rgb(255, 255, 255)" data-darkmode-color-15886839320558="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15886839320558="rgba(230, 230, 230, 0.9)" data-darkmode-color-159923607914210="rgba(163, 163, 163, 0.9)" data-darkmode-original-color-159923607914210="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-159923607914210="rgb(25, 25, 25)" data-darkmode-original-bgcolor-159923607914210="rgb(255, 255, 255)" data-darkmode-bgcolor-160008070860010="rgb(25, 25, 25)" data-darkmode-original-bgcolor-160008070860010="rgb(255, 255, 255)" data-darkmode-color-160008070860010="rgba(163, 163, 163, 0.9)" data-darkmode-original-color-160008070860010="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-16072664870629="rgb(25, 25, 25)" data-darkmode-original-bgcolor-16072664870629="rgb(255, 255, 255)" data-darkmode-color-16072664870629="rgba(163, 163, 163, 0.9)" data-darkmode-original-color-16072664870629="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-16073544711184="rgb(25, 25, 25)" data-darkmode-original-bgcolor-16073544711184="rgb(255, 255, 255)" data-darkmode-color-16073544711184="rgba(163, 163, 163, 0.9)" data-darkmode-original-color-16073544711184="rgba(230, 230, 230, 0.9)" style="max-width: 100%;letter-spacing: 0.544px;word-spacing: 1.6px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><p style="max-width: 100%;min-height: 1em;font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;text-size-adjust: auto;text-align: left;box-sizing: border-box !important;overflow-wrap: break-word !important;"><img class="__bg_gif" data-ratio="0.08658008658008658"  data-type="gif" data-w="462" data-width="100%" style="color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;display: block;box-sizing: border-box !important;overflow-wrap: break-word !important;visibility: visible !important;width: 578px !important;" src="https://www.zkxjob.com/wp-content/uploads/2022/07/wxsync-2022-07-ae45c8833e6e59cceba3c2fda2df37d1.gif"  /></p><p style="max-width: 100%;min-height: 1em;font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;text-size-adjust: auto;text-align: left;box-sizing: border-box !important;overflow-wrap: break-word !important;"><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></p>


推荐阅读:

入门: 最全的零基础学Python的问题  | 零基础学了8个月的Python  | 实战项目 |学Python就是这条捷径


干货:爬取豆瓣短评,电影《后来的我们》 | 38年NBA最佳球员分析 |   从万众期待到口碑扑街!唐探3令人失望  | 笑看新倚天屠龙记 | 灯谜答题王 |用Python做个海量小姐姐素描图 |碟中谍这么火,我用机器学习做个迷你推荐系统电影


趣味:弹球游戏  | 九宫格  | 漂亮的花 | 两百行Python《天天酷跑》游戏!


AI: 会做诗的机器人 | 给图片上色 | 预测收入 | 碟中谍这么火,我用机器学习做个迷你推荐系统电影


小工具: Pdf转Word,轻松搞定表格和水印! | 一键把html网页保存为pdf!|  再见PDF提取收费! | 用90行代码打造最强PDF转换器,word、PPT、excel、markdown、html一键转换 | 制作一款钉钉低价机票提示器! |60行代码做了一个语音壁纸切换器天天看小姐姐!


年度爆款文案

  • 1).卧槽!Pdf转Word用Python轻松搞定

  • 2).学Python真香!我用100行代码做了个网站,帮人PS旅行图片,赚个鸡腿吃

  • 3).首播过亿,火爆全网,我分析了《乘风破浪的姐姐》,发现了这些秘密 

  • 4).80行代码!用Python做一个哆来A梦分身 

  • 5).你必须掌握的20个python代码,短小精悍,用处无穷 

  • 6).30个Python奇淫技巧集 

  • 7).我总结的80页《菜鸟学Python精选干货.pdf》,都是干货 

  • 8).再见Python!我要学Go了!2500字深度分析!

  • 9).发现一个舔狗福利!这个Python爬虫神器太爽了,自动下载妹子图片


<section data-mpa-template="t" mpa-from-tpl="t" data-darkmode-bgcolor-15923650965579="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15923650965579="rgb(255, 255, 255)" data-darkmode-color-15923650965579="rgb(168, 168, 168)" data-darkmode-original-color-15923650965579="rgb(62, 62, 62)" data-style="color: rgb(62, 62, 62); font-size: 15px; letter-spacing: 0.544px; background-color: rgb(255, 255, 255); font-family: monospace; text-align: left; widows: 1; word-spacing: 2px; caret-color: rgb(255, 0, 0); white-space: pre-wrap;" style="max-width: 100%;font-size: 15px;letter-spacing: 0.544px;word-spacing: 2px;caret-color: rgb(255, 0, 0);color: rgb(62, 62, 62);white-space: pre-wrap;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section mpa-from-tpl="t" data-darkmode-bgcolor-15923650965579="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15923650965579="rgb(255, 255, 255)" data-darkmode-color-15923650965579="rgb(168, 168, 168)" data-darkmode-original-color-15923650965579="rgb(62, 62, 62)" style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><pre data-darkmode-bgcolor-15923650965579="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15923650965579="rgb(255, 255, 255)" data-darkmode-color-15923650965579="rgb(167, 167, 167)" data-darkmode-original-color-15923650965579="rgb(63, 63, 63)" data-style="letter-spacing: 0.544px; font-size: 16px; color: rgb(63, 63, 63); word-spacing: 1px; line-height: inherit;" style="max-width: 100%;letter-spacing: 0.544px;font-size: 16px;color: rgb(63, 63, 63);word-spacing: 1px;line-height: inherit;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section data-mpa-template-id="1250" data-mpa-color="#ffffff" data-mpa-category="divider" data-darkmode-bgcolor="rgb(36, 36, 36)" data-darkmode-original-bgcolor="rgb(255, 255, 255)" data-darkmode-color="rgb(230, 230, 230)" data-darkmode-original-color="rgb(0, 0, 0)" data-style="margin-right: 0.5em; margin-left: 0.5em; white-space: normal; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; color: rgb(0, 0, 0); letter-spacing: 0px; word-spacing: 2px;" data-darkmode-bgcolor-15923650965579="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15923650965579="rgb(255, 255, 255)" data-darkmode-color-15923650965579="rgb(230, 230, 230)" data-darkmode-original-color-15923650965579="rgb(0, 0, 0)" style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><pre data-darkmode-bgcolor-15923650965579="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15923650965579="rgb(255, 255, 255)" data-darkmode-color-15923650965579="rgb(167, 167, 167)" data-darkmode-original-color-15923650965579="rgb(63, 63, 63)" data-style="letter-spacing: 0.544px; font-size: 16px; color: rgb(63, 63, 63); word-spacing: 1px; line-height: inherit;" style="max-width: 100%;letter-spacing: 0.544px;line-height: inherit;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section data-mpa-template-id="1250" data-mpa-color="#ffffff" data-mpa-category="divider" data-darkmode-bgcolor="rgb(36, 36, 36)" data-darkmode-original-bgcolor="rgb(255, 255, 255)" data-darkmode-color="rgb(230, 230, 230)" data-darkmode-original-color="rgb(0, 0, 0)" data-style="margin-right: 0.5em; margin-left: 0.5em; white-space: normal; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; color: rgb(0, 0, 0); letter-spacing: 0px; word-spacing: 2px;" data-darkmode-bgcolor-15923650965579="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15923650965579="rgb(255, 255, 255)" data-darkmode-color-15923650965579="rgb(230, 230, 230)" data-darkmode-original-color-15923650965579="rgb(0, 0, 0)" style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section powered-by="xiumi.us" data-darkmode-bgcolor="rgb(36, 36, 36)" data-darkmode-original-bgcolor="rgb(255, 255, 255)" data-darkmode-color="rgb(230, 230, 230)" data-darkmode-original-color="rgb(0, 0, 0)" data-darkmode-bgcolor-15923650965579="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15923650965579="rgb(255, 255, 255)" data-darkmode-color-15923650965579="rgb(230, 230, 230)" data-darkmode-original-color-15923650965579="rgb(0, 0, 0)" style="margin-right: 0em;margin-left: 0em;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="margin-right: 0.5em;margin-left: 0.5em;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><pre data-darkmode-bgcolor="rgb(36, 36, 36)" data-darkmode-original-bgcolor="rgb(255, 255, 255)" data-darkmode-color="rgb(168, 168, 168)" data-darkmode-original-color="rgb(62, 62, 62)" data-style="letter-spacing: 0.544px; font-weight: 700; text-align: -webkit-center; background-color: rgb(255, 255, 255); font-size: 16px; color: rgb(62, 62, 62); widows: 1; word-spacing: 2px;" style="max-width: 100%;letter-spacing: 0.544px;text-align: center;color: rgb(62, 62, 62);box-sizing: border-box !important;overflow-wrap: break-word !important;"><section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><pre data-darkmode-bgcolor="rgb(36, 36, 36)" data-darkmode-original-bgcolor="rgb(255, 255, 255)" data-darkmode-color="rgb(168, 168, 168)" data-darkmode-original-color="rgb(62, 62, 62)" data-style="letter-spacing: 0.544px; font-weight: 700; text-align: -webkit-center; background-color: rgb(255, 255, 255); font-size: 16px; color: rgb(62, 62, 62); widows: 1; word-spacing: 2px;" style="max-width: 100%;letter-spacing: 0.544px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><pre style="max-width: 100%;letter-spacing: 0.544px;text-align: left;box-sizing: border-box !important;overflow-wrap: break-word !important;"><h1 style="max-width: 100%;white-space: pre-wrap;letter-spacing: 0.544px;font-family: 微软雅黑;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section mpa-from-tpl="t" style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><pre style="max-width: 100%;letter-spacing: 0.544px;line-height: inherit;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section data-mpa-template="t" mpa-from-tpl="t" style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section data-id="94086" data-color="#276ca3" data-tools="135编辑器" mpa-from-tpl="t" style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section mpa-from-tpl="t" style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><pre style="max-width: 100%;color: rgb(63, 63, 63);letter-spacing: 0.544px;line-height: inherit;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section data-mpa-template="t" mpa-from-tpl="t" style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section data-id="94086" data-color="#276ca3" data-tools="135编辑器" mpa-from-tpl="t" style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section mpa-from-tpl="t" style="max-width: 100%;display: inline-block;box-sizing: border-box !important;overflow-wrap: break-word !important;"><pre style="max-width: 100%;letter-spacing: 0.544px;line-height: inherit;box-sizing: border-box !important;overflow-wrap: break-word !important;"><pre data-darkmode-bgcolor-15882384789136="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15882384789136="rgb(255, 255, 255)" data-style="letter-spacing: 0.544px; background-color: rgb(255, 255, 255); text-align: center; color: rgba(230, 230, 230, 0.9); font-size: 16px; line-height: 25.6px; overflow-wrap: break-word !important;" data-darkmode-bgcolor-15882396318564="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15882396318564="rgb(255, 255, 255)" data-darkmode-color-15882396318564="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15882396318564="rgba(230, 230, 230, 0.9)" data-darkmode-bgcolor-15900529136199="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15900529136199="rgb(255, 255, 255)" data-darkmode-color-15900529136199="rgba(230, 230, 230, 0.9)" data-darkmode-original-color-15900529136199="rgba(230, 230, 230, 0.9)" style="max-width: 100%;letter-spacing: 0.544px;text-align: center;color: rgba(230, 230, 230, 0.9);line-height: 25.6px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section data-darkmode-bgcolor-15860613985508="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15860613985508="rgb(255, 255, 255)" data-darkmode-color-15860613985508="rgb(230, 230, 230)" data-darkmode-original-color-15860613985508="rgb(0, 0, 0)" data-darkmode-bgcolor-15870356070738="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15870356070738="rgb(255, 255, 255)" data-darkmode-color-15870356070738="rgb(230, 230, 230)" data-darkmode-original-color-15870356070738="rgb(0, 0, 0)" data-darkmode-bgcolor-15870356071023="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15870356071023="rgb(255, 255, 255)" data-darkmode-color-15870356071023="rgb(230, 230, 230)" data-darkmode-original-color-15870356071023="rgb(0, 0, 0)" data-darkmode-bgcolor-15882384789136="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15882384789136="rgb(255, 255, 255)" data-darkmode-color-15882384789136="rgb(230, 230, 230)" data-darkmode-original-color-15882384789136="rgb(0, 0, 0)" data-darkmode-bgcolor-15882396318564="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15882396318564="rgb(255, 255, 255)" data-darkmode-color-15882396318564="rgb(230, 230, 230)" data-darkmode-original-color-15882396318564="rgb(0, 0, 0)" data-darkmode-bgcolor-15900529136199="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15900529136199="rgb(255, 255, 255)" data-darkmode-color-15900529136199="rgb(230, 230, 230)" data-darkmode-original-color-15900529136199="rgb(0, 0, 0)" style="max-width: 100%;display: inline-block;clear: both;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section data-tools="135编辑器" data-id="91842" data-darkmode-bgcolor-15860613985508="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15860613985508="rgb(255, 255, 255)" data-darkmode-color-15860613985508="rgb(230, 230, 230)" data-darkmode-original-color-15860613985508="rgb(0, 0, 0)" data-darkmode-bgcolor-15870356070738="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15870356070738="rgb(255, 255, 255)" data-darkmode-color-15870356070738="rgb(230, 230, 230)" data-darkmode-original-color-15870356070738="rgb(0, 0, 0)" data-darkmode-bgcolor-15870356071023="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15870356071023="rgb(255, 255, 255)" data-darkmode-color-15870356071023="rgb(230, 230, 230)" data-darkmode-original-color-15870356071023="rgb(0, 0, 0)" data-darkmode-bgcolor-15882384789136="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15882384789136="rgb(255, 255, 255)" data-darkmode-color-15882384789136="rgb(230, 230, 230)" data-darkmode-original-color-15882384789136="rgb(0, 0, 0)" data-darkmode-bgcolor-15882396318564="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15882396318564="rgb(255, 255, 255)" data-darkmode-color-15882396318564="rgb(230, 230, 230)" data-darkmode-original-color-15882396318564="rgb(0, 0, 0)" data-darkmode-bgcolor-15900529136199="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15900529136199="rgb(255, 255, 255)" data-darkmode-color-15900529136199="rgb(230, 230, 230)" data-darkmode-original-color-15900529136199="rgb(0, 0, 0)" style="max-width: 100%;letter-spacing: 0.544px;border-width: 0px;border-style: none;border-color: initial;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section data-darkmode-bgcolor-15860613985508="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15860613985508="rgb(255, 255, 255)" data-darkmode-color-15860613985508="rgb(230, 230, 230)" data-darkmode-original-color-15860613985508="rgb(0, 0, 0)" data-darkmode-bgcolor-15870356070738="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15870356070738="rgb(255, 255, 255)" data-darkmode-color-15870356070738="rgb(230, 230, 230)" data-darkmode-original-color-15870356070738="rgb(0, 0, 0)" data-darkmode-bgcolor-15870356071023="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15870356071023="rgb(255, 255, 255)" data-darkmode-color-15870356071023="rgb(230, 230, 230)" data-darkmode-original-color-15870356071023="rgb(0, 0, 0)" data-darkmode-bgcolor-15882384789136="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15882384789136="rgb(255, 255, 255)" data-darkmode-color-15882384789136="rgb(230, 230, 230)" data-darkmode-original-color-15882384789136="rgb(0, 0, 0)" data-darkmode-bgcolor-15882396318564="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15882396318564="rgb(255, 255, 255)" data-darkmode-color-15882396318564="rgb(230, 230, 230)" data-darkmode-original-color-15882396318564="rgb(0, 0, 0)" data-darkmode-bgcolor-15900529136199="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15900529136199="rgb(255, 255, 255)" data-darkmode-color-15900529136199="rgb(230, 230, 230)" data-darkmode-original-color-15900529136199="rgb(0, 0, 0)" style="max-width: 100%;display: inline-block;clear: both;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section data-brushtype="text" data-darkmode-bgcolor-15860613985508="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15860613985508="rgb(255, 255, 255)" data-darkmode-color-15860613985508="rgb(230, 230, 230)" data-darkmode-original-color-15860613985508="rgb(0, 0, 0)" data-darkmode-bgimage-15860613985508="1" data-style="padding: 18px 15px 20px 10px; color: rgb(86, 146, 214); text-align: center; letter-spacing: 1.5px; background-image: url('https://www.zkxjob.com/wp-content/uploads/2022/07/wxsync-2022-07-a2a8a5e1e58f30392066a170034ee027.png'); background-size: 100% 100%; background-repeat: no-repeat; overflow-wrap: break-word !important;" data-darkmode-bgcolor-15870356070738="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15870356070738="rgb(255, 255, 255)" data-darkmode-color-15870356070738="rgb(230, 230, 230)" data-darkmode-original-color-15870356070738="rgb(0, 0, 0)" data-darkmode-bgimage-15870356070738="1" data-darkmode-bgcolor-15870356071023="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15870356071023="rgb(255, 255, 255)" data-darkmode-color-15870356071023="rgb(230, 230, 230)" data-darkmode-original-color-15870356071023="rgb(0, 0, 0)" data-darkmode-bgimage-15870356071023="1" data-darkmode-bgcolor-15882384789136="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15882384789136="rgb(255, 255, 255)" data-darkmode-color-15882384789136="rgb(230, 230, 230)" data-darkmode-original-color-15882384789136="rgb(0, 0, 0)" data-darkmode-bgimage-15882384789136="1" data-darkmode-bgcolor-15882396318564="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15882396318564="rgb(255, 255, 255)" data-darkmode-color-15882396318564="rgb(230, 230, 230)" data-darkmode-original-color-15882396318564="rgb(0, 0, 0)" data-darkmode-bgimage-15882396318564="1" data-darkmode-bgcolor-15900529136199="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15900529136199="rgb(255, 255, 255)" data-darkmode-color-15900529136199="rgb(230, 230, 230)" data-darkmode-original-color-15900529136199="rgb(0, 0, 0)" data-darkmode-bgimage-15900529136199="1" style="padding: 18px 15px 20px 10px;max-width: 100%;background-size: 100% 100%;background-image: url('https://www.zkxjob.com/wp-content/uploads/2022/07/wxsync-2022-07-a2a8a5e1e58f30392066a170034ee027.png');color: rgb(86, 146, 214);letter-spacing: 1.5px;background-repeat: no-repeat;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section data-darkmode-bgcolor-15860613985508="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15860613985508="rgb(255, 255, 255)" data-darkmode-color-15860613985508="rgb(230, 230, 230)" data-darkmode-original-color-15860613985508="rgb(0, 0, 0)" data-darkmode-bgimage-15860613985508="1" data-darkmode-bgcolor-15870356070738="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15870356070738="rgb(255, 255, 255)" data-darkmode-color-15870356070738="rgb(230, 230, 230)" data-darkmode-original-color-15870356070738="rgb(0, 0, 0)" data-darkmode-bgimage-15870356070738="1" data-darkmode-bgcolor-15870356071023="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15870356071023="rgb(255, 255, 255)" data-darkmode-color-15870356071023="rgb(230, 230, 230)" data-darkmode-original-color-15870356071023="rgb(0, 0, 0)" data-darkmode-bgimage-15870356071023="1" data-darkmode-bgcolor-15882384789136="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15882384789136="rgb(255, 255, 255)" data-darkmode-color-15882384789136="rgb(230, 230, 230)" data-darkmode-original-color-15882384789136="rgb(0, 0, 0)" data-darkmode-bgimage-15882384789136="1" data-darkmode-bgcolor-15882396318564="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15882396318564="rgb(255, 255, 255)" data-darkmode-color-15882396318564="rgb(230, 230, 230)" data-darkmode-original-color-15882396318564="rgb(0, 0, 0)" data-darkmode-bgimage-15882396318564="1" data-darkmode-bgcolor-15900529136199="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15900529136199="rgb(255, 255, 255)" data-darkmode-color-15900529136199="rgb(230, 230, 230)" data-darkmode-original-color-15900529136199="rgb(0, 0, 0)" data-darkmode-bgimage-15900529136199="1" style="max-width: 100%;display: flex;justify-content: center;align-items: center;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section data-darkmode-bgcolor-15860613985508="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15860613985508="rgb(255, 255, 255)" data-darkmode-color-15860613985508="rgb(230, 230, 230)" data-darkmode-original-color-15860613985508="rgb(0, 0, 0)" data-darkmode-bgimage-15860613985508="1" data-darkmode-bgcolor-15870356070738="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15870356070738="rgb(255, 255, 255)" data-darkmode-color-15870356070738="rgb(230, 230, 230)" data-darkmode-original-color-15870356070738="rgb(0, 0, 0)" data-darkmode-bgimage-15870356070738="1" data-darkmode-bgcolor-15870356071023="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15870356071023="rgb(255, 255, 255)" data-darkmode-color-15870356071023="rgb(230, 230, 230)" data-darkmode-original-color-15870356071023="rgb(0, 0, 0)" data-darkmode-bgimage-15870356071023="1" data-darkmode-bgcolor-15882384789136="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15882384789136="rgb(255, 255, 255)" data-darkmode-color-15882384789136="rgb(230, 230, 230)" data-darkmode-original-color-15882384789136="rgb(0, 0, 0)" data-darkmode-bgimage-15882384789136="1" data-darkmode-bgcolor-15882396318564="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15882396318564="rgb(255, 255, 255)" data-darkmode-color-15882396318564="rgb(230, 230, 230)" data-darkmode-original-color-15882396318564="rgb(0, 0, 0)" data-darkmode-bgimage-15882396318564="1" data-darkmode-bgcolor-15900529136199="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15900529136199="rgb(255, 255, 255)" data-darkmode-color-15900529136199="rgb(230, 230, 230)" data-darkmode-original-color-15900529136199="rgb(0, 0, 0)" data-darkmode-bgimage-15900529136199="1" style="margin-left: 2px;max-width: 100%;width: 20px;box-sizing: border-box !important;overflow-wrap: break-word !important;"></section><section data-brushtype="text" data-darkmode-bgcolor-15860613985508="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15860613985508="rgb(255, 255, 255)" data-darkmode-color-15860613985508="rgb(51, 51, 51)" data-darkmode-original-color-15860613985508="rgb(51, 51, 51)" data-darkmode-bgimage-15860613985508="1" data-darkmode-bgcolor-15870356070738="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15870356070738="rgb(255, 255, 255)" data-darkmode-color-15870356070738="rgb(51, 51, 51)" data-darkmode-original-color-15870356070738="rgb(51, 51, 51)" data-darkmode-bgimage-15870356070738="1" data-darkmode-bgcolor-15870356071023="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15870356071023="rgb(255, 255, 255)" data-darkmode-color-15870356071023="rgb(51, 51, 51)" data-darkmode-original-color-15870356071023="rgb(51, 51, 51)" data-darkmode-bgimage-15870356071023="1" data-darkmode-bgcolor-15882384789136="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15882384789136="rgb(255, 255, 255)" data-darkmode-color-15882384789136="rgb(51, 51, 51)" data-darkmode-original-color-15882384789136="rgb(51, 51, 51)" data-darkmode-bgimage-15882384789136="1" data-darkmode-bgcolor-15882396318564="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15882396318564="rgb(255, 255, 255)" data-darkmode-color-15882396318564="rgb(51, 51, 51)" data-darkmode-original-color-15882396318564="rgb(51, 51, 51)" data-darkmode-bgimage-15882396318564="1" data-darkmode-bgcolor-15900529136199="rgb(36, 36, 36)" data-darkmode-original-bgcolor-15900529136199="rgb(255, 255, 255)" data-darkmode-color-15900529136199="rgb(51, 51, 51)" data-darkmode-original-color-15900529136199="rgb(51, 51, 51)" data-darkmode-bgimage-15900529136199="1" style="max-width: 100%;font-size: 14px;color: rgb(51, 51, 51);text-align: left;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;font-family: 楷体, 楷体_GB2312, SimKai;white-space: pre-wrap;font-size: 12px;box-sizing: border-box !important;overflow-wrap: break-word !important;">点阅读原文,领廖雪峰资料!</span></section></section></section></section></section></section></section>

本篇文章来源于: 菜鸟学Python

本文为原创文章,版权归所有,欢迎分享本文,转载请保留出处!

知行编程网
知行编程网 关注:1    粉丝:1
这个人很懒,什么都没写

你可能也喜欢

热评文章

发表评论

表情 格式 链接 私密 签到
扫一扫二维码分享