diff --git a/README.md b/README.md index d3c1b1e..e50523f 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Matplotlib可以说是python数据可视化最重要且常见的工具之一, - 使用前请将matplotlib升级至V3.4.2以上(2022年1月),否则可能会出现报错! - 本教程独立网站已上线:[https://datawhalechina.github.io/fantastic-matplotlib/](https://datawhalechina.github.io/fantastic-matplotlib/) -- 使用时若发现任何问题,或是你对项目内容有好的建议,欢迎留言交流,联系邮箱skywateryang@126.com +- 使用时若发现任何问题,或是你对项目内容有好的建议,欢迎留言交流,联系邮箱skywateryang@126.com,微信`skywateryang` ## 目录 @@ -60,6 +60,8 @@ Matplotlib可以说是python数据可视化最重要且常见的工具之一, + + ## 致谢 感谢以下Datawhale成员对项目推进作出的贡献(排名不分先后): diff --git a/docs/_images/index_10_01.png b/docs/_images/index_10_01.png index 1a2c21d..42323e9 100644 Binary files a/docs/_images/index_10_01.png and b/docs/_images/index_10_01.png differ diff --git a/docs/_images/index_10_02.png b/docs/_images/index_10_02.png index 3687698..86d86f3 100644 Binary files a/docs/_images/index_10_02.png and b/docs/_images/index_10_02.png differ diff --git a/docs/_images/index_11_0.png b/docs/_images/index_11_0.png index 867ad50..20f49b0 100644 Binary files a/docs/_images/index_11_0.png and b/docs/_images/index_11_0.png differ diff --git a/docs/_images/index_11_01.png b/docs/_images/index_11_01.png index 39e0b7f..f1f2803 100644 Binary files a/docs/_images/index_11_01.png and b/docs/_images/index_11_01.png differ diff --git a/docs/_images/index_12_0.png b/docs/_images/index_12_0.png index 3707f3c..3abe72e 100644 Binary files a/docs/_images/index_12_0.png and b/docs/_images/index_12_0.png differ diff --git a/docs/_images/index_12_01.png b/docs/_images/index_12_01.png index 3707f3c..7988fb6 100644 Binary files a/docs/_images/index_12_01.png and b/docs/_images/index_12_01.png differ diff --git a/docs/_images/index_13_01.png b/docs/_images/index_13_01.png index 4400ac5..3707f3c 100644 Binary files a/docs/_images/index_13_01.png and b/docs/_images/index_13_01.png differ diff --git a/docs/_images/index_14_0.png b/docs/_images/index_14_0.png index 475934c..4689b1a 100644 Binary files a/docs/_images/index_14_0.png and b/docs/_images/index_14_0.png differ diff --git a/docs/_images/index_15_01.png b/docs/_images/index_15_01.png index 72e80d6..475934c 100644 Binary files a/docs/_images/index_15_01.png and b/docs/_images/index_15_01.png differ diff --git a/docs/_images/index_17_01.png b/docs/_images/index_17_01.png index d59e517..ca7223c 100644 Binary files a/docs/_images/index_17_01.png and b/docs/_images/index_17_01.png differ diff --git a/docs/_images/index_18_0.png b/docs/_images/index_18_0.png index 8dcb423..d59e517 100644 Binary files a/docs/_images/index_18_0.png and b/docs/_images/index_18_0.png differ diff --git a/docs/_images/index_18_01.png b/docs/_images/index_18_01.png new file mode 100644 index 0000000..fcbc857 Binary files /dev/null and b/docs/_images/index_18_01.png differ diff --git a/docs/_images/index_19_0.png b/docs/_images/index_19_0.png index a80f3af..6eb8262 100644 Binary files a/docs/_images/index_19_0.png and b/docs/_images/index_19_0.png differ diff --git a/docs/_images/index_20_0.png b/docs/_images/index_20_0.png index 15928ef..a80f3af 100644 Binary files a/docs/_images/index_20_0.png and b/docs/_images/index_20_0.png differ diff --git a/docs/_images/index_20_01.png b/docs/_images/index_20_01.png index 12b0cdc..7d39af1 100644 Binary files a/docs/_images/index_20_01.png and b/docs/_images/index_20_01.png differ diff --git a/docs/_images/index_22_0.png b/docs/_images/index_22_0.png new file mode 100644 index 0000000..1cd4e1c Binary files /dev/null and b/docs/_images/index_22_0.png differ diff --git a/docs/_images/index_22_01.png b/docs/_images/index_22_01.png new file mode 100644 index 0000000..c5ba250 Binary files /dev/null and b/docs/_images/index_22_01.png differ diff --git a/docs/_images/index_23_0.png b/docs/_images/index_23_0.png index 1db9264..12b0cdc 100644 Binary files a/docs/_images/index_23_0.png and b/docs/_images/index_23_0.png differ diff --git a/docs/_images/index_24_0.png b/docs/_images/index_24_0.png new file mode 100644 index 0000000..652f756 Binary files /dev/null and b/docs/_images/index_24_0.png differ diff --git a/docs/_images/index_24_01.png b/docs/_images/index_24_01.png new file mode 100644 index 0000000..11d8154 Binary files /dev/null and b/docs/_images/index_24_01.png differ diff --git a/docs/_images/index_25_0.png b/docs/_images/index_25_0.png index 41aacdf..29a9b88 100644 Binary files a/docs/_images/index_25_0.png and b/docs/_images/index_25_0.png differ diff --git a/docs/_images/index_26_0.png b/docs/_images/index_26_0.png new file mode 100644 index 0000000..41aacdf Binary files /dev/null and b/docs/_images/index_26_0.png differ diff --git a/docs/_images/index_26_01.png b/docs/_images/index_26_01.png new file mode 100644 index 0000000..ff9aaba Binary files /dev/null and b/docs/_images/index_26_01.png differ diff --git a/docs/_images/index_27_0.png b/docs/_images/index_27_0.png index 794bf0a..16fd71d 100644 Binary files a/docs/_images/index_27_0.png and b/docs/_images/index_27_0.png differ diff --git a/docs/_images/index_28_0.png b/docs/_images/index_28_0.png new file mode 100644 index 0000000..c94370a Binary files /dev/null and b/docs/_images/index_28_0.png differ diff --git a/docs/_images/index_28_01.png b/docs/_images/index_28_01.png new file mode 100644 index 0000000..68a168b Binary files /dev/null and b/docs/_images/index_28_01.png differ diff --git a/docs/_images/index_30_1.png b/docs/_images/index_30_1.png new file mode 100644 index 0000000..4efebe4 Binary files /dev/null and b/docs/_images/index_30_1.png differ diff --git a/docs/_images/index_31_0.png b/docs/_images/index_31_0.png index 8599934..9d6e31b 100644 Binary files a/docs/_images/index_31_0.png and b/docs/_images/index_31_0.png differ diff --git a/docs/_images/index_32_0.png b/docs/_images/index_32_0.png new file mode 100644 index 0000000..8599934 Binary files /dev/null and b/docs/_images/index_32_0.png differ diff --git a/docs/_images/index_33_0.png b/docs/_images/index_33_0.png index 62b843c..d892206 100644 Binary files a/docs/_images/index_33_0.png and b/docs/_images/index_33_0.png differ diff --git a/docs/_images/index_34_0.png b/docs/_images/index_34_0.png new file mode 100644 index 0000000..62b843c Binary files /dev/null and b/docs/_images/index_34_0.png differ diff --git a/docs/_images/index_36_1.png b/docs/_images/index_36_1.png new file mode 100644 index 0000000..51bf26c Binary files /dev/null and b/docs/_images/index_36_1.png differ diff --git a/docs/_images/index_37_0.png b/docs/_images/index_37_0.png index 65fc75e..fe7c273 100644 Binary files a/docs/_images/index_37_0.png and b/docs/_images/index_37_0.png differ diff --git a/docs/_images/index_38_0.png b/docs/_images/index_38_0.png new file mode 100644 index 0000000..65fc75e Binary files /dev/null and b/docs/_images/index_38_0.png differ diff --git a/docs/_images/index_3_0.png b/docs/_images/index_3_0.png index 46e5873..c6bea08 100644 Binary files a/docs/_images/index_3_0.png and b/docs/_images/index_3_0.png differ diff --git a/docs/_images/index_3_01.png b/docs/_images/index_3_01.png index d182e1b..0699039 100644 Binary files a/docs/_images/index_3_01.png and b/docs/_images/index_3_01.png differ diff --git a/docs/_images/index_3_02.png b/docs/_images/index_3_02.png index bd02dda..7988fb6 100644 Binary files a/docs/_images/index_3_02.png and b/docs/_images/index_3_02.png differ diff --git a/docs/_images/index_40_0.png b/docs/_images/index_40_0.png new file mode 100644 index 0000000..9ac6d79 Binary files /dev/null and b/docs/_images/index_40_0.png differ diff --git a/docs/_images/index_4_01.png b/docs/_images/index_4_01.png index a9bd66e..d182e1b 100644 Binary files a/docs/_images/index_4_01.png and b/docs/_images/index_4_01.png differ diff --git a/docs/_images/index_4_02.png b/docs/_images/index_4_02.png index 4d9ee9c..bd02dda 100644 Binary files a/docs/_images/index_4_02.png and b/docs/_images/index_4_02.png differ diff --git a/docs/_images/index_5_01.png b/docs/_images/index_5_01.png index df6adb3..a9bd66e 100644 Binary files a/docs/_images/index_5_01.png and b/docs/_images/index_5_01.png differ diff --git a/docs/_images/index_7_0.png b/docs/_images/index_7_0.png index 8806b4f..efe9400 100644 Binary files a/docs/_images/index_7_0.png and b/docs/_images/index_7_0.png differ diff --git a/docs/_images/index_7_01.png b/docs/_images/index_7_01.png index c284416..bb37240 100644 Binary files a/docs/_images/index_7_01.png and b/docs/_images/index_7_01.png differ diff --git a/docs/_images/index_7_1.png b/docs/_images/index_7_1.png new file mode 100644 index 0000000..243bc4a Binary files /dev/null and b/docs/_images/index_7_1.png differ diff --git a/docs/_images/index_8_01.png b/docs/_images/index_8_01.png index ee0c5ec..c284416 100644 Binary files a/docs/_images/index_8_01.png and b/docs/_images/index_8_01.png differ diff --git a/docs/_images/index_8_02.png b/docs/_images/index_8_02.png new file mode 100644 index 0000000..84d3978 Binary files /dev/null and b/docs/_images/index_8_02.png differ diff --git a/docs/_images/index_9_0.png b/docs/_images/index_9_0.png index daee4be..18dd689 100644 Binary files a/docs/_images/index_9_0.png and b/docs/_images/index_9_0.png differ diff --git a/docs/_images/index_9_01.png b/docs/_images/index_9_01.png index 42323e9..f7ce619 100644 Binary files a/docs/_images/index_9_01.png and b/docs/_images/index_9_01.png differ diff --git a/docs/_sources/第二回:艺术画笔见乾坤/index.md.txt b/docs/_sources/第二回:艺术画笔见乾坤/index.md.txt index 791dc73..d7da62c 100644 --- a/docs/_sources/第二回:艺术画笔见乾坤/index.md.txt +++ b/docs/_sources/第二回:艺术画笔见乾坤/index.md.txt @@ -6,6 +6,9 @@ kernelspec: display_name: Python 3 name: python3 --- + + +# 第二回:艺术画笔见乾坤 ```{code-cell} ipython3 import numpy as np import pandas as pd @@ -16,9 +19,6 @@ from matplotlib.lines import Line2D from matplotlib.patches import Circle, Wedge from matplotlib.collections import PatchCollection ``` - -# 第二回:艺术画笔见乾坤 - ## 一、概述 ### 1. matplotlib的三层api @@ -224,7 +224,7 @@ Patch类的构造函数: hatch=None, fill=True, capstyle=None, joinstyle=None, **kwargs) -本小节重点讲述三种最常见的子类,矩形,多边形和楔型。 +本小节重点讲述三种最常见的子类,矩形,多边形和楔形。 #### a. Rectangle-矩形 @@ -251,10 +251,11 @@ Rectangle本身的主要比较简单,即xy控制锚点,width和height分别 + **log**: bool,默认False,即y坐标轴是否选择指数刻度 + **stacked**: bool,默认为False,是否为堆积状图 -hist绘制直方图 + ```{code-cell} ipython3 +# hist绘制直方图 x=np.random.randint(0,100,100) #生成[0-100)之间的100个数据,即 数据集 bins=np.arange(0,101,10) #设置连续的边界值,即直方图的分布区间[0,10),[10,20)... plt.hist(x,bins,color='fuchsia',alpha=0.5)#alpha设置透明度,0为完全透明 @@ -268,10 +269,11 @@ plt.xlim(0,100); #设置x轴分布范围 plt.show() -`Rectangle`矩形类绘制直方图 + ```{code-cell} ipython3 +# Rectangle矩形类绘制直方图 df = pd.DataFrame(columns = ['data']) df.loc[:,'data'] = x df['fenzu'] = pd.cut(df['data'], bins=bins, right = False,include_lowest=True) @@ -402,10 +404,11 @@ matplotlib.pyplot.pie语法: + **colors**:饼图循环使用的颜色序列。如果取值为None,将使用当前活动循环中的颜色。 + **startangle**:饼状图开始的绘制的角度。 -pie绘制饼状图 + ```{code-cell} ipython3 +# pie绘制饼状图 labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' sizes = [15, 30, 45, 10] explode = (0, 0.1, 0, 0) @@ -420,10 +423,11 @@ ax1.axis('equal'); # Equal aspect ratio ensures that pie is drawn as a circle. -wedge绘制饼图 + ```{code-cell} ipython3 +# wedge绘制饼图 fig = plt.figure(figsize=(5,5)) ax1 = fig.add_subplot(111) theta1 = 0 diff --git a/docs/_sources/第五回:样式色彩秀芳华/index.md.txt b/docs/_sources/第五回:样式色彩秀芳华/index.md.txt index c8f94b0..734778f 100644 --- a/docs/_sources/第五回:样式色彩秀芳华/index.md.txt +++ b/docs/_sources/第五回:样式色彩秀芳华/index.md.txt @@ -7,7 +7,11 @@ kernelspec: name: python3 --- # 第五回:样式色彩秀芳华 - +```{code-cell} ipython3 +import matplotlib as mpl +import matplotlib.pyplot as plt +import numpy as np +``` 第五回详细介绍matplotlib中样式和颜色的使用,绘图样式和颜色是丰富可视化图表的重要手段,因此熟练掌握本章可以让可视化图表变得更美观,突出重点和凸显艺术性。 关于绘图样式,常见的有3种方法,分别是修改预定义样式,自定义样式和rcparams。 @@ -23,11 +27,7 @@ kernelspec: matplotlib贴心地提供了许多内置的样式供用户使用,使用方法很简单,只需在python脚本的最开始输入想使用style的名称即可调用,尝试调用不同内置样式,比较区别 -```{code-cell} ipython3 -import matplotlib as mpl -import matplotlib.pyplot as plt -import numpy as np -``` + ```{code-cell} ipython3 @@ -125,7 +125,7 @@ plt.plot([1,2,3,4],[2,3,4,5]); -另外matplotlib也还提供了了一种更便捷的修改样式方式,可以一次性修改多个样式。 +另外matplotlib也还提供了一种更便捷的修改样式方式,可以一次性修改多个样式。 ```{code-cell} ipython3 @@ -142,7 +142,6 @@ plt.plot([1,2,3,4],[2,3,4,5]); `色相`: 没有明显的顺序性、一般不用来表达数据量的高低,而是用来表达数据列的类别。 `明度和饱和度`: 在视觉上很容易区分出优先级的高低、被用作表达顺序或者表达数据量视觉通道。 具体关于色彩理论部分的知识,不属于本教程的重点,请参阅有关拓展材料学习。 -[ECharts数据可视化实验室](https://vis.baidu.com/chartcolor/basis/) [学会这6个可视化配色基本技巧,还原数据本身的意义](https://zhuanlan.zhihu.com/p/88892542) 在matplotlib中,设置颜色有以下几种方式: diff --git a/docs/_sources/第四回:文字图例尽眉目/index.md.txt b/docs/_sources/第四回:文字图例尽眉目/index.md.txt index 679c7ef..6ac1044 100644 --- a/docs/_sources/第四回:文字图例尽眉目/index.md.txt +++ b/docs/_sources/第四回:文字图例尽眉目/index.md.txt @@ -368,7 +368,7 @@ ax.xaxis.set_major_formatter(formatoddticks); 在普通的绘图中,我们可以直接通过上图的set_ticks进行设置刻度的位置,缺点是需要自己指定或者接受matplotlib默认给定的刻度。当需要更改刻度的位置时,matplotlib给了常用的几种locator的类型。如果要绘制更复杂的图,可以先设置locator的类型,然后通过axs.xaxis.set_major_locator(locator)绘制即可 -locator=plt.MaxNLocator(nbins=7) +locator=plt.MaxNLocator(nbins=7)#自动选择合适的位置,并且刻度之间最多不超过7(nbins)个间隔 locator=plt.FixedLocator(locs=[0,0.5,1.5,2.5,3.5,4.5,5.5,6])#直接指定刻度所在的位置 locator=plt.AutoLocator()#自动分配刻度值的位置 locator=plt.IndexLocator(offset=0.5, base=1)#面元间距是1,从0.5开始 @@ -385,7 +385,7 @@ for n, ax in enumerate(axs.flat): locator = matplotlib.ticker.AutoLocator() axs[0, 0].xaxis.set_major_locator(locator) -locator = matplotlib.ticker.MaxNLocator(nbins=10) +locator = matplotlib.ticker.MaxNLocator(nbins=3) axs[0, 1].xaxis.set_major_locator(locator) diff --git a/docs/searchindex.js b/docs/searchindex.js index 88b642b..531d7e6 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["index","\u7b2c\u4e00\u56de\uff1aMatplotlib\u521d\u76f8\u8bc6/index","\u7b2c\u4e09\u56de\uff1a\u5e03\u5c40\u683c\u5f0f\u5b9a\u65b9\u5706/index","\u7b2c\u4e8c\u56de\uff1a\u827a\u672f\u753b\u7b14\u89c1\u4e7e\u5764/index","\u7b2c\u4e94\u56de\uff1a\u6837\u5f0f\u8272\u5f69\u79c0\u82b3\u534e/index","\u7b2c\u56db\u56de\uff1a\u6587\u5b57\u56fe\u4f8b\u5c3d\u7709\u76ee/index"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":3,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":2,"sphinx.domains.rst":2,"sphinx.domains.std":2,sphinx:56},filenames:["index.md","\u7b2c\u4e00\u56de\uff1aMatplotlib\u521d\u76f8\u8bc6\\index.md","\u7b2c\u4e09\u56de\uff1a\u5e03\u5c40\u683c\u5f0f\u5b9a\u65b9\u5706\\index.md","\u7b2c\u4e8c\u56de\uff1a\u827a\u672f\u753b\u7b14\u89c1\u4e7e\u5764\\index.md","\u7b2c\u4e94\u56de\uff1a\u6837\u5f0f\u8272\u5f69\u79c0\u82b3\u534e\\index.md","\u7b2c\u56db\u56de\uff1a\u6587\u5b57\u56fe\u4f8b\u5c3d\u7709\u76ee\\index.md"],objects:{},objnames:{},objtypes:{},terms:{"05":[3,5],"0f0f0f":4,"0f0f0f80":4,"0x00000298ae900a30":3,"0x00000298ae900dc0":3,"0x23155916dc0":1,"10":[2,3,4,5],"100":[1,3,5],"1000":[3,5],"101":3,"11":3,"111":3,"125":3,"14":5,"15":[3,5],"150":2,"16":[3,4,5],"162":3,"17":3,"1981":2,"1990":2,"1f":[3,5],"20":[2,3,4,5],"200":2,"2017":5,"21":5,"211":3,"224":2,"24":4,"25":[3,5],"26":4,"28":5,"2d":1,"2f":[3,5],"30":[3,5],"324":3,"343182":3,"360":3,"45":3,"50":4,"536818":3,"54":3,"5f":5,"70":5,"75":2,"775x0":3,"90":[3,5],"95":3,"class":3,"default":4,"float":5,"for":[2,3,5],"if":[2,5],"import":[1,2,3,4,5],"in":[2,3,5],"int":3,"return":5,"true":[2,3,5],"with":5,_classic_test_patch:4,abcd:2,add:3,add_ax:3,add_collect:3,add_gridspec:2,add_lin:3,add_patch:3,add_subplot:[2,3,5],ai:3,align:3,all:3,alpha:[2,3,4,5],and:[3,4],angl:3,antialias:3,api:1,arang:[3,5],arc3:5,area:[2,3],arg:[3,5],arrai:3,arrowprop:5,arrowstyl:5,as:[1,2,3,4,5],ascend:3,aspect:3,ast_node_interact:3,astyp:3,at:[1,3],autoloc:5,autopct:3,avail:4,ax1:3,ax2:3,ax:[1,2,3,5],axes:[0,1,2,4],axesimag:3,axessubplot:3,axhlin:2,axi:[1,5],axlin:2,axs:[2,3,5],axvlin:2,backend_bas:3,backgroundcolor:5,bar:3,bar_label:5,barsabov:3,barstack:3,base:5,baselin:5,bbox:5,bessel:3,best:5,bicub:3,bilinear:3,bin:3,black:[4,5],block:5,blue:[4,5],bmh:4,bold:5,book:5,bool:3,both:5,bottom:[3,5],box:5,bright:4,by:5,bymonthdai:5,canva:3,capsiz:3,capstyl:3,capthick:3,catrom:3,center:[3,5],center_baselin:5,chart:3,circl:3,circlecollect:3,classic:4,close:3,cmap:[2,3,4],co:3,code:5,color:[0,2,3,5],colorblind10:4,colorblind:4,colorhexa:4,column:3,com:4,connectionstyl:5,contain:[0,1],coord:5,core:3,cos:5,count:3,counterclock:3,csv:2,cubic:1,current:3,cursiv:5,cut:3,cyan:4,cyclic:4,dai:5,dark:4,dark_background:4,darkgrid:4,dash_capstyl:3,dash_joinstyl:3,data:[2,3,5],data_interv:3,datafram:3,date:5,dateformatt:5,datetim:5,dayloc:5,deep:4,def:5,delax:3,demi:5,demibold:5,densiti:3,descript:5,df:3,df_cnt:3,dict:5,diverg:4,dog:3,down:5,drawn:3,drawstyl:3,drop:3,drug:3,echart:4,ecolor:3,edgecolor:[3,5],elinewidth:3,els:[2,5],ensur:3,entri:5,enumer:5,equal:3,error:3,errorbar:3,erroreveri:3,exp:5,explod:3,extent:3,extra:5,facecolor:[3,5],fals:[2,3,5],famili:5,fancybboxpatch:5,fantasi:5,fast:4,fenzu:3,fig1:3,fig:[1,2,3,5],figsiz:[2,3,5],figtext:5,figur:[0,2],figurecanva:3,figureimag:3,file:4,fill:3,fillstyl:3,filternorm:3,filterrad:3,findal:3,first:3,five:5,fivethirtyeight:4,fixedloc:5,flat:[3,5],fmt:3,font:[2,5],fontdict:5,fontfamili:5,fontnam:5,fontproperti:5,fontsiz:5,fontstyl:5,fontweight:5,format:5,formatoddtick:5,formatstrformatt:[3,5],formatt:3,four:5,frame:3,frameon:5,frog:3,from:3,fuchsia:3,funcformatt:5,gaussian:3,get_data_interv:3,get_ticklabel:3,get_ticklin:[3,5],get_tickloc:3,get_view_interv:3,ggplot:4,github:2,grai:5,grayscal:4,green:[3,4],grid:[2,3],gridlin:3,ha:5,ham:3,han:3,handl:5,hatch:3,heavi:5,height:3,height_ratio:2,helper:3,hermit:3,hist:3,histogram:3,histtyp:3,hog:3,horizont:5,horizontalalign:5,hsv:2,html:4,http:4,imlim:3,imshow:3,include_lowest:3,index:[2,3],indexloc:5,inplac:3,interactiveshel:3,interp_method:3,interpol:3,ipython:[1,3],is:[3,5],ital:5,joinstyl:3,jupyt:1,kaiser:3,kei:5,kwarg:[3,5],label1:3,label2:3,label:[1,3,5],labelcolor:3,labeldist:3,labelleft:3,labelpad:5,labelright:3,labels:4,lambda:3,lanczo:3,larg:5,layout_ex1:2,left:[3,5],legend:[0,1,3],len:[3,5],light:5,lightgoldenrodyellow:3,lightslategrai:3,line2d:[1,5],line:[1,4,5],line_down:5,line_up:5,linear:[1,3],linearloc:5,linespac:5,linestyl:[1,3,4],linewidth:[1,3,4],linspac:[1,3,5],list:[2,5],loc:[3,5],locat:3,log:[2,3],lolim:3,lower:5,lw:3,magenta:4,major:3,map:3,marker:[3,5],markeredgecolor:3,markeredgewidth:3,markerfacecolor:3,markerfacecoloralt:3,markers:[3,4],markeveri:3,matlab:1,matplotlib:[0,2,5],maxi:3,maxnloc:5,mdate:5,medium:5,method:3,microsoft:5,mid:3,mini:3,minor:3,miscellan:4,mitchel:3,modifi:5,monospac:5,mpl:[1,4],mplstyle:4,multipl:5,multipleloc:5,mute:4,nbin:5,ncol:[2,3],nearest:3,none:[3,5],norm:3,normal:[3,5],notebook:[1,4],np:[1,2,3,4,5],nrow:[2,3],numer:5,numpi:[1,2,3,4,5],numtick:5,object:[0,1,5],obliqu:5,odd:5,of:5,offset:5,one:5,oo:[1,2,5],or:5,orang:3,org:4,orient:[1,5],origin:3,pa:3,pad:5,palett:4,panda:[1,2,3],paper:4,pass:2,pastel:4,patch:5,patchcollect:3,pathcollect:3,pattern:5,pctdistanc:3,pd:[2,3],pi:[2,3,5],pickradiu:3,pie:3,plot:[1,2,3,4,5],plotnonfinit:3,plt:[1,3,4,5],polar:2,polycollect:3,pos:5,posit:5,poster:4,present:4,primit:0,print:[3,4,5],project:2,prop:5,properti:5,pyplot:[1,2,3,4,5],python:[1,4],quadrat:1,quadric:3,qualit:4,rad:5,radiu:3,rand:[2,3],randint:3,randn:[2,4],random:[2,3,4],rang:[2,3,5],ratio:3,rc:[1,4],rcparam:[2,5],rdpu:4,re:3,rect:3,red:[3,4,5],regular:5,regularpolycollect:3,render:3,resampl:3,reset_index:3,right:[3,5],roman:5,rotat:5,rotatelabel:3,san:[2,5],scatter:[2,3,4],score:3,seaborn:[1,4],self:3,semibold:5,sequenti:4,serif:[2,5],set_antialias:3,set_arrai:3,set_color:3,set_facecolor:3,set_fonts:3,set_major_formatt:[3,5],set_major_loc:5,set_markeredgewidth:3,set_markers:3,set_minor_formatt:5,set_minor_loc:5,set_rot:3,set_tick:5,set_tick_param:3,set_ticklabel:5,set_ticks_posit:5,set_titl:[1,2,3,5],set_xlabel:[1,2,5],set_xlim:[2,3],set_xscal:2,set_xtick:5,set_xticklabel:5,set_ylabel:[1,2,5],set_ylim:[2,3],set_yscal:2,setp:3,shadow:3,shape:3,share:3,sharei:2,sharex:2,shell:1,show:[1,3],shrink:5,simhei:2,simpl:1,simsun:5,sin:3,sinc:3,six:5,size:[2,3,5],small:5,solarize_light2:4,solid_capstyl:3,solid_joinstyl:3,sort_valu:3,spec:2,spline16:3,spline36:3,stabl:4,stack:3,startangl:3,state:3,step1:1,step2:1,step3:1,step4:1,step5:1,step:3,stepfil:3,str:3,string:5,strmethodformatt:5,style:[0,1,5],sub1:2,sub2:2,sub3:2,sub4:2,sub5:2,subplot:[1,3,5],subplot_kw:3,sum:3,suptitl:2,tableau:4,talk:4,tan:4,text:3,textcoord:5,textprop:3,that:3,the:3,theta1:3,theta2:3,theta:2,thi:5,three:5,tick1:3,tick1lin:3,tick2:3,tick2lin:3,tick:[0,1,4],tick_param:5,ticker:[3,5],tickla:5,ticklabel:5,ticklin:5,tight_layout:[2,3,5],time:5,timedelta:5,titl:1,titles:4,top:5,trick:1,truetyp:5,tupl:3,tutori:4,two:5,ultralight:5,unicod:5,unicode_minu:[2,5],up:5,uplim:3,upper:5,url:3,use:4,va:5,valu:5,value_count:3,vert:3,vertic:5,verticalalign:5,view_interv:3,viridi:3,vmax:3,vmin:3,web:1,wedgeprop:3,weight:5,which:3,white:4,whitegrid:4,width:3,width_ratio:2,window:1,www:4,x1:5,xaxi:[3,5],xdata:3,xerr:3,xlabel:[1,3],xlim:3,xlolim:3,xscal:3,xtick:[3,4],xuplim:3,xx:5,xy:[3,5],xycoord:5,xytext:5,y1:[3,5],y2:3,yahei:5,yaxi:3,ydata:3,yellow:[3,4],yerr:3,ylabel:[1,3],ytick:[3,4],yyyi:3,zero:5,zip:3},titles:["Content","\u7b2c\u4e00\u56de\uff1aMatplotlib\u521d\u76f8\u8bc6","\u7b2c\u4e09\u56de\uff1a\u5e03\u5c40\u683c\u5f0f\u5b9a\u65b9\u5706","\u7b2c\u4e8c\u56de\uff1a\u827a\u672f\u753b\u7b14\u89c1\u4e7e\u5764","\u7b2c\u4e94\u56de\uff1a\u6837\u5f0f\u8272\u5f69\u79c0\u82b3\u534e","\u7b2c\u56db\u56de\uff1a\u6587\u5b57\u56fe\u4f8b\u5c3d\u7709\u76ee"],titleterms:{"2dline":3,and:5,annot:5,api:[3,5],artist:3,axes:[3,5],axi:3,collect:3,color:4,colormap:4,contain:3,content:0,figur:[1,3,5],formatt:5,gridspec:2,hex:4,imag:3,legend:5,line2d:3,line:3,locat:5,matplotlib:[1,3,4],object:3,patch:3,plt:2,polygon:3,primit:3,rcparam:4,rectangl:3,rgb:4,rgba:4,style:4,stylesheet:4,subplot:2,suptitl:5,text:5,tick:[3,5],titl:5,wedg:3,xlabel:5,ylabel:5}}) \ No newline at end of file +Search.setIndex({docnames:["index","\u7b2c\u4e00\u56de\uff1aMatplotlib\u521d\u76f8\u8bc6/index","\u7b2c\u4e09\u56de\uff1a\u5e03\u5c40\u683c\u5f0f\u5b9a\u65b9\u5706/index","\u7b2c\u4e8c\u56de\uff1a\u827a\u672f\u753b\u7b14\u89c1\u4e7e\u5764/index","\u7b2c\u4e94\u56de\uff1a\u6837\u5f0f\u8272\u5f69\u79c0\u82b3\u534e/index","\u7b2c\u56db\u56de\uff1a\u6587\u5b57\u56fe\u4f8b\u5c3d\u7709\u76ee/index"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":3,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":2,"sphinx.domains.rst":2,"sphinx.domains.std":2,sphinx:56},filenames:["index.md","\u7b2c\u4e00\u56de\uff1aMatplotlib\u521d\u76f8\u8bc6\\index.md","\u7b2c\u4e09\u56de\uff1a\u5e03\u5c40\u683c\u5f0f\u5b9a\u65b9\u5706\\index.md","\u7b2c\u4e8c\u56de\uff1a\u827a\u672f\u753b\u7b14\u89c1\u4e7e\u5764\\index.md","\u7b2c\u4e94\u56de\uff1a\u6837\u5f0f\u8272\u5f69\u79c0\u82b3\u534e\\index.md","\u7b2c\u56db\u56de\uff1a\u6587\u5b57\u56fe\u4f8b\u5c3d\u7709\u76ee\\index.md"],objects:{},objnames:{},objtypes:{},terms:{"05":[3,5],"0f0f0f":4,"0f0f0f80":4,"0x0000029ff51e0a90":3,"0x0000029ff51e0e20":3,"0x23155916dc0":1,"10":[2,3,4,5],"100":[1,3,5],"1000":[3,5],"101":3,"11":3,"111":3,"125":3,"14":5,"15":[3,5],"150":2,"16":[3,4,5],"162":3,"17":3,"1981":2,"1990":2,"1f":[3,5],"20":[2,3,4,5],"200":2,"2017":5,"21":5,"211":3,"224":2,"24":4,"25":[3,5],"26":4,"28":5,"2d":1,"2f":[3,5],"30":[3,5],"324":3,"343182":3,"360":3,"45":3,"50":4,"536818":3,"54":3,"5f":5,"70":5,"75":2,"775x0":3,"90":[3,5],"95":3,"class":3,"default":4,"float":5,"for":[2,3,5],"if":[2,5],"import":[1,2,3,4,5],"in":[2,3,5],"int":3,"return":5,"true":[2,3,5],"with":5,_classic_test_patch:4,abcd:2,add:3,add_ax:3,add_collect:3,add_gridspec:2,add_lin:3,add_patch:3,add_subplot:[2,3,5],ai:3,align:3,all:3,alpha:[2,3,4,5],and:[3,4],angl:3,antialias:3,api:1,arang:[3,5],arc3:5,area:[2,3],arg:[3,5],arrai:3,arrowprop:5,arrowstyl:5,as:[1,2,3,4,5],ascend:3,aspect:3,ast_node_interact:3,astyp:3,at:[1,3],autoloc:5,autopct:3,avail:4,ax1:3,ax2:3,ax:[1,2,3,5],axes:[0,1,2,4],axesimag:3,axessubplot:3,axhlin:2,axi:[1,5],axlin:2,axs:[2,3,5],axvlin:2,backend_bas:3,backgroundcolor:5,bar:3,bar_label:5,barsabov:3,barstack:3,base:5,baselin:5,bbox:5,bessel:3,best:5,bicub:3,bilinear:3,bin:3,black:[4,5],block:5,blue:[4,5],bmh:4,bold:5,book:5,bool:3,both:5,bottom:[3,5],box:5,bright:4,by:5,bymonthdai:5,canva:3,capsiz:3,capstyl:3,capthick:3,catrom:3,center:[3,5],center_baselin:5,chart:3,circl:3,circlecollect:3,classic:4,close:3,cmap:[2,3,4],co:3,code:5,color:[0,2,3,5],colorblind10:4,colorblind:4,colorhexa:4,column:3,com:4,connectionstyl:5,contain:[0,1],coord:5,core:3,cos:5,count:3,counterclock:3,csv:2,cubic:1,current:3,cursiv:5,cut:3,cyan:4,cyclic:4,dai:5,dark:4,dark_background:4,darkgrid:4,dash_capstyl:3,dash_joinstyl:3,data:[2,3,5],data_interv:3,datafram:3,date:5,dateformatt:5,datetim:5,dayloc:5,deep:4,def:5,delax:3,demi:5,demibold:5,densiti:3,descript:5,df:3,df_cnt:3,dict:5,diverg:4,dog:3,down:5,drawn:3,drawstyl:3,drop:3,drug:3,ecolor:3,edgecolor:[3,5],elinewidth:3,els:[2,5],ensur:3,entri:5,enumer:5,equal:3,error:3,errorbar:3,erroreveri:3,exp:5,explod:3,extent:3,extra:5,facecolor:[3,5],fals:[2,3,5],famili:5,fancybboxpatch:5,fantasi:5,fast:4,fenzu:3,fig1:3,fig:[1,2,3,5],figsiz:[2,3,5],figtext:5,figur:[0,2],figurecanva:3,figureimag:3,file:4,fill:3,fillstyl:3,filternorm:3,filterrad:3,findal:3,first:3,five:5,fivethirtyeight:4,fixedloc:5,flat:[3,5],fmt:3,font:[2,5],fontdict:5,fontfamili:5,fontnam:5,fontproperti:5,fontsiz:5,fontstyl:5,fontweight:5,format:5,formatoddtick:5,formatstrformatt:[3,5],formatt:3,four:5,frame:3,frameon:5,frog:3,from:3,fuchsia:3,funcformatt:5,gaussian:3,get_data_interv:3,get_ticklabel:3,get_ticklin:[3,5],get_tickloc:3,get_view_interv:3,ggplot:4,github:2,grai:5,grayscal:4,green:[3,4],grid:[2,3],gridlin:3,ha:5,ham:3,han:3,handl:5,hatch:3,heavi:5,height:3,height_ratio:2,helper:3,hermit:3,hist:3,histogram:3,histtyp:3,hog:3,horizont:5,horizontalalign:5,hsv:2,html:4,http:4,imlim:3,imshow:3,include_lowest:3,index:[2,3],indexloc:5,inplac:3,interactiveshel:3,interp_method:3,interpol:3,ipython:[1,3],is:[3,5],ital:5,joinstyl:3,jupyt:1,kaiser:3,kei:5,kwarg:[3,5],label1:3,label2:3,label:[1,3,5],labelcolor:3,labeldist:3,labelleft:3,labelpad:5,labelright:3,labels:4,lambda:3,lanczo:3,larg:5,layout_ex1:2,left:[3,5],legend:[0,1,3],len:[3,5],light:5,lightgoldenrodyellow:3,lightslategrai:3,line2d:[1,5],line:[1,4,5],line_down:5,line_up:5,linear:[1,3],linearloc:5,linespac:5,linestyl:[1,3,4],linewidth:[1,3,4],linspac:[1,3,5],list:[2,5],loc:[3,5],locat:3,log:[2,3],lolim:3,lower:5,lw:3,magenta:4,major:3,map:3,marker:[3,5],markeredgecolor:3,markeredgewidth:3,markerfacecolor:3,markerfacecoloralt:3,markers:[3,4],markeveri:3,matlab:1,matplotlib:[0,2,5],maxi:3,maxnloc:5,mdate:5,medium:5,method:3,microsoft:5,mid:3,mini:3,minor:3,miscellan:4,mitchel:3,modifi:5,monospac:5,mpl:[1,4],mplstyle:4,multipl:5,multipleloc:5,mute:4,nbin:5,ncol:[2,3],nearest:3,none:[3,5],norm:3,normal:[3,5],notebook:[1,4],np:[1,2,3,4,5],nrow:[2,3],numer:5,numpi:[1,2,3,4,5],numtick:5,object:[0,1,5],obliqu:5,odd:5,of:5,offset:5,one:5,oo:[1,2,5],or:5,orang:3,org:4,orient:[1,5],origin:3,pa:3,pad:5,palett:4,panda:[1,2,3],paper:4,pass:2,pastel:4,patch:5,patchcollect:3,pathcollect:3,pattern:5,pctdistanc:3,pd:[2,3],pi:[2,3,5],pickradiu:3,pie:3,plot:[1,2,3,4,5],plotnonfinit:3,plt:[1,3,4,5],polar:2,polycollect:3,pos:5,posit:5,poster:4,present:4,primit:0,print:[3,4,5],project:2,prop:5,properti:5,pyplot:[1,2,3,4,5],python:[1,4],quadrat:1,quadric:3,qualit:4,rad:5,radiu:3,rand:[2,3],randint:3,randn:[2,4],random:[2,3,4],rang:[2,3,5],ratio:3,rc:[1,4],rcparam:[2,5],rdpu:4,re:3,rect:3,red:[3,4,5],regular:5,regularpolycollect:3,render:3,resampl:3,reset_index:3,right:[3,5],roman:5,rotat:5,rotatelabel:3,san:[2,5],scatter:[2,3,4],score:3,seaborn:[1,4],self:3,semibold:5,sequenti:4,serif:[2,5],set_antialias:3,set_arrai:3,set_color:3,set_facecolor:3,set_fonts:3,set_major_formatt:[3,5],set_major_loc:5,set_markeredgewidth:3,set_markers:3,set_minor_formatt:5,set_minor_loc:5,set_rot:3,set_tick:5,set_tick_param:3,set_ticklabel:5,set_ticks_posit:5,set_titl:[1,2,3,5],set_xlabel:[1,2,5],set_xlim:[2,3],set_xscal:2,set_xtick:5,set_xticklabel:5,set_ylabel:[1,2,5],set_ylim:[2,3],set_yscal:2,setp:3,shadow:3,shape:3,share:3,sharei:2,sharex:2,shell:1,show:[1,3],shrink:5,simhei:2,simpl:1,simsun:5,sin:3,sinc:3,six:5,size:[2,3,5],small:5,solarize_light2:4,solid_capstyl:3,solid_joinstyl:3,sort_valu:3,spec:2,spline16:3,spline36:3,stabl:4,stack:3,startangl:3,state:3,step1:1,step2:1,step3:1,step4:1,step5:1,step:3,stepfil:3,str:3,string:5,strmethodformatt:5,style:[0,1,5],sub1:2,sub2:2,sub3:2,sub4:2,sub5:2,subplot:[1,3,5],subplot_kw:3,sum:3,suptitl:2,tableau:4,talk:4,tan:4,text:3,textcoord:5,textprop:3,that:3,the:3,theta1:3,theta2:3,theta:2,thi:5,three:5,tick1:3,tick1lin:3,tick2:3,tick2lin:3,tick:[0,1,4],tick_param:5,ticker:[3,5],tickla:5,ticklabel:5,ticklin:5,tight_layout:[2,3,5],time:5,timedelta:5,titl:1,titles:4,top:5,trick:1,truetyp:5,tupl:3,tutori:4,two:5,ultralight:5,unicod:5,unicode_minu:[2,5],up:5,uplim:3,upper:5,url:3,use:4,va:5,valu:5,value_count:3,vert:3,vertic:5,verticalalign:5,view_interv:3,viridi:3,vmax:3,vmin:3,web:1,wedgeprop:3,weight:5,which:3,white:4,whitegrid:4,width:3,width_ratio:2,window:1,www:4,x1:5,xaxi:[3,5],xdata:3,xerr:3,xlabel:[1,3],xlim:3,xlolim:3,xscal:3,xtick:[3,4],xuplim:3,xx:5,xy:[3,5],xycoord:5,xytext:5,y1:[3,5],y2:3,yahei:5,yaxi:3,ydata:3,yellow:[3,4],yerr:3,ylabel:[1,3],ytick:[3,4],yyyi:3,zero:5,zip:3},titles:["Content","\u7b2c\u4e00\u56de\uff1aMatplotlib\u521d\u76f8\u8bc6","\u7b2c\u4e09\u56de\uff1a\u5e03\u5c40\u683c\u5f0f\u5b9a\u65b9\u5706","\u7b2c\u4e8c\u56de\uff1a\u827a\u672f\u753b\u7b14\u89c1\u4e7e\u5764","\u7b2c\u4e94\u56de\uff1a\u6837\u5f0f\u8272\u5f69\u79c0\u82b3\u534e","\u7b2c\u56db\u56de\uff1a\u6587\u5b57\u56fe\u4f8b\u5c3d\u7709\u76ee"],titleterms:{"2dline":3,and:5,annot:5,api:[3,5],artist:3,axes:[3,5],axi:3,collect:3,color:4,colormap:4,contain:3,content:0,figur:[1,3,5],formatt:5,gridspec:2,hex:4,imag:3,legend:5,line2d:3,line:3,locat:5,matplotlib:[1,3,4],object:3,patch:3,plt:2,polygon:3,primit:3,rcparam:4,rectangl:3,rgb:4,rgba:4,style:4,stylesheet:4,subplot:2,suptitl:5,text:5,tick:[3,5],titl:5,wedg:3,xlabel:5,ylabel:5}}) \ No newline at end of file diff --git a/docs/第二回:艺术画笔见乾坤/index.html b/docs/第二回:艺术画笔见乾坤/index.html index feb11e8..8ac23d8 100644 --- a/docs/第二回:艺术画笔见乾坤/index.html +++ b/docs/第二回:艺术画笔见乾坤/index.html @@ -307,7 +307,9 @@
import numpy as np
import pandas as pd
@@ -321,8 +323,6 @@
+
+
[<matplotlib.lines.Line2D object at 0x00000298AE900A30>, <matplotlib.lines.Line2D object at 0x00000298AE900DC0>]
+[<matplotlib.lines.Line2D object at 0x0000029FF51E0A90>, <matplotlib.lines.Line2D object at 0x0000029FF51E0E20>]
-
+
+
本小节重点讲述三种最常见的子类,矩形,多边形和楔型。 本小节重点讲述三种最常见的子类,矩形,多边形和楔形。 log: bool,默认False,即y坐标轴是否选择指数刻度 stacked: bool,默认为False,是否为堆积状图 hist绘制直方图 colors:饼图循环使用的颜色序列。如果取值为None,将使用当前活动循环中的颜色。 startangle:饼状图开始的绘制的角度。 pie绘制饼状图 wedge绘制饼图 由于 第五回详细介绍matplotlib中样式和颜色的使用,绘图样式和颜色是丰富可视化图表的重要手段,因此熟练掌握本章可以让可视化图表变得更美观,突出重点和凸显艺术性。 matplotlib贴心地提供了许多内置的样式供用户使用,使用方法很简单,只需在python脚本的最开始输入想使用style的名称即可调用,尝试调用不同内置样式,比较区别 那么matplotlib究竟内置了那些样式供使用呢?总共以下26种丰富的样式可供选择。
@@ -545,7 +545,7 @@ pyplot里有个专门绘制误差线的功能,通过
-
+
@@ -562,7 +562,7 @@ linewidth=None, linestyle=None, antialiased=None,
hatch=None, fill=True, capstyle=None, joinstyle=None,
**kwargs)a. Rectangle-矩形¶
Rectangle矩形类在官网中的定义是: 通过锚点xy及其宽度和高度生成。
@@ -586,10 +586,10 @@ Rectangle本身的主要比较简单,即xy控制锚点,width和height分别
x=np.random.randint(0,100,100) #生成[0-100)之间的100个数据,即 数据集
+
# hist绘制直方图
+x=np.random.randint(0,100,100) #生成[0-100)之间的100个数据,即 数据集
bins=np.arange(0,101,10) #设置连续的边界值,即直方图的分布区间[0,10),[10,20)...
plt.hist(x,bins,color='fuchsia',alpha=0.5)#alpha设置透明度,0为完全透明
plt.xlabel('scores')
@@ -599,14 +599,14 @@ Rectangle本身的主要比较简单,即xy控制锚点,width和height分别
+
Rectangle矩形类绘制直方图df = pd.DataFrame(columns = ['data'])
+
# Rectangle矩形类绘制直方图
+df = pd.DataFrame(columns = ['data'])
df.loc[:,'data'] = x
df['fenzu'] = pd.cut(df['data'], bins=bins, right = False,include_lowest=True)
@@ -632,7 +632,7 @@ Rectangle本身的主要比较简单,即xy控制锚点,width和height分别
+
+
+
+
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
+
# pie绘制饼状图
+labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
sizes = [15, 30, 45, 10]
explode = (0, 0.1, 0, 0)
fig1, ax1 = plt.subplots()
@@ -754,15 +754,15 @@ closed为True则指定多边形将起点和终点重合从而显式关闭多边
+
fig = plt.figure(figsize=(5,5))
+
# wedge绘制饼图
+fig = plt.figure(figsize=(5,5))
ax1 = fig.add_subplot(111)
theta1 = 0
sizes = [15, 30, 45, 10]
@@ -781,7 +781,7 @@ closed为True则指定多边形将起点和终点重合从而显式关闭多边
+
+
+
+
Figure维持了current axes,因此你不应该手动的从Figure.axes列表中添加删除元素,而是要通过Figure.add_subplot()、Figure.add_axes()来添加元素,通过Figure.delaxes()来删除元素。但是你可以迭代或者访问Figure.axes中的Axes,然后修改这个Axes的属性。
+
+
array([-0.2, 4.2])
+
+
+
第五回:样式色彩秀芳华¶
+import matplotlib as mpl
+import matplotlib.pyplot as plt
+import numpy as np
+
关于绘图样式,常见的有3种方法,分别是修改预定义样式,自定义样式和rcparams。
关于颜色使用,本章介绍了常见的5种表示单色颜色的基本方法,以及colormap多色显示的方法。import matplotlib as mpl
-import matplotlib.pyplot as plt
-import numpy as np
-
plt.style.use('default')
plt.plot([1,2,3,4],[2,3,4,5]);
+
+
+
值得特别注意的是,matplotlib支持混合样式的引用,只需在引用时输入一个样式列表,若是几个样式中涉及到同一个参数,右边的样式表会覆盖左边的值。
@@ -349,7 +349,7 @@ ytick.labelsize : 16
+
+
+
另外matplotlib也还提供了了一种更便捷的修改样式方式,可以一次性修改多个样式。
+另外matplotlib也还提供了一种更便捷的修改样式方式,可以一次性修改多个样式。
mpl.rc('lines', linewidth=4, linestyle='-.')
@@ -389,7 +389,7 @@ ytick.labelsize : 16
+
色相: 没有明显的顺序性、一般不用来表达数据量的高低,而是用来表达数据列的类别。明度和饱和度: 在视觉上很容易区分出优先级的高低、被用作表达顺序或者表达数据量视觉通道。在matplotlib中,设置颜色有以下几种方式:
+
+
RGB颜色和HEX颜色之间是可以一一对应的,以下网址提供了两种色彩表示方法的转换工具。
@@ -453,7 +452,7 @@ ytick.labelsize : 16
+
+
+
@@ -507,7 +506,7 @@ ytick.labelsize : 16
+
在以下官网页面可以查询上述五种colormap的字符串表示和颜色图的对应关系
diff --git a/docs/第四回:文字图例尽眉目/index.html b/docs/第四回:文字图例尽眉目/index.html
index 5049942..977ff3a 100644
--- a/docs/第四回:文字图例尽眉目/index.html
+++ b/docs/第四回:文字图例尽眉目/index.html
@@ -391,7 +391,7 @@
+
@@ -467,7 +467,7 @@ ylabel方式类似,这里不重复写出。
+
@@ -493,7 +493,7 @@ ylabel方式类似,这里不重复写出。
+
@@ -523,7 +523,7 @@ annotate的参数非常复杂,这里仅仅展示一个简单的例子,更多
+
@@ -589,7 +589,7 @@ annotate的参数非常复杂,这里仅仅展示一个简单的例子,更多
+
@@ -608,7 +608,7 @@ annotate的参数非常复杂,这里仅仅展示一个简单的例子,更多
+
@@ -668,7 +668,7 @@ annotate的参数非常复杂,这里仅仅展示一个简单的例子,更多
+
@@ -689,7 +689,7 @@ annotate的参数非常复杂,这里仅仅展示一个简单的例子,更多
+
@@ -698,7 +698,7 @@ annotate的参数非常复杂,这里仅仅展示一个简单的例子,更多在普通的绘图中,我们可以直接通过上图的set_ticks进行设置刻度的位置,缺点是需要自己指定或者接受matplotlib默认给定的刻度。当需要更改刻度的位置时,matplotlib给了常用的几种locator的类型。如果要绘制更复杂的图,可以先设置locator的类型,然后通过axs.xaxis.set_major_locator(locator)绘制即可
-locator=plt.MaxNLocator(nbins=7)
+locator=plt.MaxNLocator(nbins=7)#自动选择合适的位置,并且刻度之间最多不超过7(nbins)个间隔
locator=plt.FixedLocator(locs=[0,0.5,1.5,2.5,3.5,4.5,5.5,6])#直接指定刻度所在的位置
locator=plt.AutoLocator()#自动分配刻度值的位置
locator=plt.IndexLocator(offset=0.5, base=1)#面元间距是1,从0.5开始
@@ -714,7 +714,7 @@ locator=plt.LinearLocator(numticks=5)#线性划分5等分,4个刻度
+
@@ -784,7 +784,7 @@ locator=plt.LinearLocator(numticks=5)#线性划分5等分,4个刻度
+
legend其他常用的几个参数如下:
@@ -844,7 +844,7 @@ ax.legend(loc='upper center') 等同于ax.legend(loc=9)
+
@@ -877,7 +877,7 @@ ax.legend(loc='upper center') 等同于ax.legend(loc=9)
+