This commit is contained in:
skywateryang 2021-06-28 13:30:27 +08:00
parent 825da1e182
commit a09f9c39a4
35 changed files with 178 additions and 148 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

@ -662,4 +662,7 @@ plt.gca().add_artist(l1);
## 参考资料
[1.matplotlib官网文字使用指南](https://matplotlib.org/stable/tutorials/text/text_intro.html#sphx-glr-tutorials-text-text-intro-py
)

View File

@ -217,6 +217,7 @@
<li class="toctree-l2"><a class="reference internal" href="%E7%AC%AC%E5%9B%9B%E5%9B%9E%EF%BC%9A%E6%96%87%E5%AD%97%E5%9B%BE%E4%BE%8B%E5%B0%BD%E7%9C%89%E7%9B%AE/index.html#figureaxes">一、Figure和Axes上的文本</a></li>
<li class="toctree-l2"><a class="reference internal" href="%E7%AC%AC%E5%9B%9B%E5%9B%9E%EF%BC%9A%E6%96%87%E5%AD%97%E5%9B%BE%E4%BE%8B%E5%B0%BD%E7%9C%89%E7%9B%AE/index.html#tick">二、Tick上的文本</a></li>
<li class="toctree-l2"><a class="reference internal" href="%E7%AC%AC%E5%9B%9B%E5%9B%9E%EF%BC%9A%E6%96%87%E5%AD%97%E5%9B%BE%E4%BE%8B%E5%B0%BD%E7%9C%89%E7%9B%AE/index.html#legend">三、legend图例</a></li>
<li class="toctree-l2"><a class="reference internal" href="%E7%AC%AC%E5%9B%9B%E5%9B%9E%EF%BC%9A%E6%96%87%E5%AD%97%E5%9B%BE%E4%BE%8B%E5%B0%BD%E7%9C%89%E7%9B%AE/index.html#id5">参考资料</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="%E7%AC%AC%E4%BA%94%E5%9B%9E%EF%BC%9A%E6%A0%B7%E5%BC%8F%E8%89%B2%E5%BD%A9%E7%A7%80%E8%8A%B3%E5%8D%8E/index.html">第五回:样式色彩秀芳华</a><ul>

View File

@ -262,6 +262,11 @@
三、legend图例
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#id5">
参考资料
</a>
</li>
</ul>
</nav>
@ -1046,6 +1051,10 @@ plt.legend(loc='best',facecolor='blue') #设置图例背景颜色,若无边框,
</div>
</div>
</div>
<div class="section" id="id5">
<h2>参考资料<a class="headerlink" href="#id5" title="永久链接至标题"></a></h2>
<p><a class="reference external" href="https://matplotlib.org/stable/tutorials/text/text_intro.html#sphx-glr-tutorials-text-text-intro-py">1.matplotlib官网文字使用指南</a></p>
</div>
</div>

View File

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "4c7cc134",
"id": "52cdf126",
"metadata": {},
"source": [
"# 第一回Matplotlib初相识\n",
@ -27,7 +27,7 @@
{
"cell_type": "code",
"execution_count": 1,
"id": "40c7890c",
"id": "d6dcb98d",
"metadata": {},
"outputs": [],
"source": [
@ -38,7 +38,7 @@
{
"cell_type": "code",
"execution_count": 2,
"id": "99516b37",
"id": "29fad847",
"metadata": {},
"outputs": [
{
@ -64,7 +64,7 @@
},
{
"cell_type": "markdown",
"id": "f905d4f6",
"id": "de6d8388",
"metadata": {},
"source": [
"**Trick**\n",
@ -82,7 +82,7 @@
{
"cell_type": "code",
"execution_count": 3,
"id": "34b97fe3",
"id": "ae3c8b3d",
"metadata": {},
"outputs": [
{
@ -107,7 +107,7 @@
},
{
"cell_type": "markdown",
"id": "9592bcfd",
"id": "dc7e3525",
"metadata": {},
"source": [
"## 三、Figure的组成\n",
@ -138,7 +138,7 @@
{
"cell_type": "code",
"execution_count": 4,
"id": "e5caa3a5",
"id": "23268625",
"metadata": {},
"outputs": [
{
@ -173,7 +173,7 @@
},
{
"cell_type": "markdown",
"id": "f6ed7722",
"id": "5ef6df20",
"metadata": {},
"source": [
"而如果采用第二种绘图接口,绘制同样的图,代码是这样的:"
@ -182,7 +182,7 @@
{
"cell_type": "code",
"execution_count": 5,
"id": "d5c496bd",
"id": "33527127",
"metadata": {},
"outputs": [
{
@ -216,7 +216,7 @@
},
{
"cell_type": "markdown",
"id": "af191fa9",
"id": "5e694c08",
"metadata": {},
"source": [
"## 参考资料\n",

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "2a2f18bc",
"id": "935a9c76",
"metadata": {},
"source": [
"# 第五回:样式色彩秀芳华\n",
@ -25,7 +25,7 @@
{
"cell_type": "code",
"execution_count": 1,
"id": "801f2685",
"id": "f26af3eb",
"metadata": {},
"outputs": [],
"source": [
@ -37,7 +37,7 @@
{
"cell_type": "code",
"execution_count": 2,
"id": "71de4d40",
"id": "19f6a449",
"metadata": {},
"outputs": [
{
@ -63,7 +63,7 @@
{
"cell_type": "code",
"execution_count": 3,
"id": "68809abd",
"id": "978aa7d8",
"metadata": {},
"outputs": [
{
@ -88,7 +88,7 @@
},
{
"cell_type": "markdown",
"id": "6088965c",
"id": "0eb8a16c",
"metadata": {},
"source": [
"那么matplotlib究竟内置了那些样式供使用呢总共以下26种丰富的样式可供选择。"
@ -97,7 +97,7 @@
{
"cell_type": "code",
"execution_count": 4,
"id": "f71c52a3",
"id": "04284094",
"metadata": {},
"outputs": [
{
@ -114,7 +114,7 @@
},
{
"cell_type": "markdown",
"id": "5d6502b4",
"id": "6e1906db",
"metadata": {},
"source": [
"### 2.用户自定义stylesheet\n",
@ -134,7 +134,7 @@
{
"cell_type": "code",
"execution_count": 5,
"id": "75c591e1",
"id": "d85a9039",
"metadata": {},
"outputs": [
{
@ -184,7 +184,7 @@
},
{
"cell_type": "markdown",
"id": "ae53fd50",
"id": "5803fa04",
"metadata": {},
"source": [
"值得特别注意的是matplotlib支持混合样式的引用只需在引用时输入一个样式列表若是几个样式中涉及到同一个参数右边的样式表会覆盖左边的值。"
@ -193,7 +193,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d460838a",
"id": "5bf998b6",
"metadata": {},
"outputs": [],
"source": [
@ -203,7 +203,7 @@
},
{
"cell_type": "markdown",
"id": "240bac7e",
"id": "ae2616df",
"metadata": {},
"source": [
"### 3.设置rcparams\n",
@ -215,7 +215,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "1576cdf4",
"id": "e844bff6",
"metadata": {},
"outputs": [],
"source": [
@ -226,7 +226,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "0355df72",
"id": "74099e00",
"metadata": {},
"outputs": [],
"source": [
@ -237,7 +237,7 @@
},
{
"cell_type": "markdown",
"id": "d4a9d05f",
"id": "6b7bc6f0",
"metadata": {},
"source": [
"另外matplotlib也还提供了了一种更便捷的修改样式方式可以一次性修改多个样式。"
@ -246,7 +246,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "edfc9b62",
"id": "246340fc",
"metadata": {},
"outputs": [],
"source": [
@ -256,7 +256,7 @@
},
{
"cell_type": "markdown",
"id": "c0538f50",
"id": "331331a8",
"metadata": {},
"source": [
"### 4.修改matplotlibrc文件\n",
@ -267,7 +267,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "86beb322",
"id": "1bea0793",
"metadata": {},
"outputs": [],
"source": [
@ -277,7 +277,7 @@
},
{
"cell_type": "markdown",
"id": "c7ea2f20",
"id": "5713057e",
"metadata": {},
"source": [
"找到路径后就可以直接编辑样式文件了打开后看到的文件格式大致是这样的文件中列举了所有的样式参数找到想要修改的参数比如lines.linewidth: 8并将前面的注释符号去掉此时再绘图发现样式以及生效了。\n",
@ -302,7 +302,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6d846010",
"id": "6bdfed0c",
"metadata": {},
"outputs": [],
"source": [
@ -312,7 +312,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "2439dcbb",
"id": "c0eb1b0f",
"metadata": {},
"outputs": [],
"source": [
@ -323,7 +323,7 @@
},
{
"cell_type": "markdown",
"id": "ebf46acc",
"id": "f7f51ec6",
"metadata": {},
"source": [
"### 2.HEX RGB 或 RGBA"
@ -332,7 +332,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "f0dc0471",
"id": "238e1742",
"metadata": {},
"outputs": [],
"source": [
@ -343,7 +343,7 @@
},
{
"cell_type": "markdown",
"id": "a2510577",
"id": "77175bc8",
"metadata": {},
"source": [
"RGB颜色和HEX颜色之间是可以一一对应的以下网址提供了两种色彩表示方法的转换工具。 \n",
@ -355,7 +355,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "45dedec2",
"id": "749e86b2",
"metadata": {},
"outputs": [],
"source": [
@ -365,7 +365,7 @@
},
{
"cell_type": "markdown",
"id": "d95a2397",
"id": "fa2c8c7a",
"metadata": {},
"source": [
"### 4.单字符基本颜色"
@ -374,7 +374,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "ae65a3ee",
"id": "b40ee633",
"metadata": {},
"outputs": [],
"source": [
@ -384,7 +384,7 @@
},
{
"cell_type": "markdown",
"id": "378a0485",
"id": "d68e9ab6",
"metadata": {},
"source": [
"### 5.颜色名称"
@ -393,7 +393,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "5e877c34",
"id": "0b76af4b",
"metadata": {},
"outputs": [],
"source": [
@ -403,7 +403,7 @@
},
{
"cell_type": "markdown",
"id": "89c8a8be",
"id": "11b5903f",
"metadata": {},
"source": [
"![](https://matplotlib.org/3.1.0/_images/sphx_glr_named_colors_002.png)\n",
@ -425,7 +425,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6126b7ed",
"id": "ef6dfd7d",
"metadata": {},
"outputs": [],
"source": [
@ -436,7 +436,7 @@
},
{
"cell_type": "markdown",
"id": "3379f57d",
"id": "d9298b92",
"metadata": {},
"source": [
"在以下官网页面可以查询上述五种colormap的字符串表示和颜色图的对应关系 \n",

File diff suppressed because one or more lines are too long

View File

@ -612,3 +612,8 @@ plt.legend([p3, p4], ['label', 'label1'], loc='lower right', scatterpoints=1)
# 为了保留之前的l1这个legend所以必须要通过plt.gca()获得当前的axes然后将l1作为单独的artist
plt.gca().add_artist(l1);
# ## 参考资料
#
# [1.matplotlib官网文字使用指南](https://matplotlib.org/stable/tutorials/text/text_intro.html#sphx-glr-tutorials-text-text-intro-py
# )

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB