From 231e71d08141f3a587b247b1ef62290cb0889e8a Mon Sep 17 00:00:00 2001 From: everyone is best one <37625649@qq.com> Date: Wed, 17 Jun 2020 11:04:32 +0800 Subject: [PATCH 1/7] Update sample_plots.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 汉化了一部分内容 --- docs/tutorials/introductory/sample_plots.md | 36 ++++++++------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/docs/tutorials/introductory/sample_plots.md b/docs/tutorials/introductory/sample_plots.md index 436daf2..4e751db 100644 --- a/docs/tutorials/introductory/sample_plots.md +++ b/docs/tutorials/introductory/sample_plots.md @@ -2,15 +2,12 @@ sidebarDepth: 3 sidebar: auto --- +# 使用Matplotlib绘制简单图形 +在此会提供很多图例以及绘制他们的代码. -# Sample plots in Matplotlib +## 折线图 -Here you'll find a host of example plots with the code that -generated them. - -## Line Plot - -Here's how to create a line plot with text labels using +创建带有文本标签的折线图 [``plot()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.plot.html#matplotlib.pyplot.plot).
@@ -22,10 +19,10 @@ Here's how to create a line plot with text labels using

-## Multiple subplots in one figure +## 一个图(figure)中含多个子图(subplots) -Multiple axes (i.e. subplots) are created with the -[``subplot()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplot.html#matplotlib.pyplot.subplot) function: +多子图使用 +[``subplot()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplot.html#matplotlib.pyplot.subplot) 函数创建:
@@ -36,10 +33,9 @@ Multiple axes (i.e. subplots) are created with the

-## Images +## 图像 -Matplotlib can display images (assuming equally spaced -horizontal dimensions) using the [``imshow()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.imshow.html#matplotlib.pyplot.imshow) function. +可以使用 [``imshow()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.imshow.html#matplotlib.pyplot.imshow) 函数来显示图像.
@@ -49,13 +45,10 @@ horizontal dimensions) using the [``imshow()``](https://matplotlib.org/api/_as_g **Example of using [``imshow()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.imshow.html#matplotlib.pyplot.imshow) to display a CT scan** -## Contouring and pseudocolor +## 热力图(pcolormesh)与等高线(contour) -The [``pcolormesh()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pcolormesh.html#matplotlib.pyplot.pcolormesh) function can make a colored -representation of a two-dimensional array, even if the horizontal dimensions -are unevenly spaced. The -[``contour()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.contour.html#matplotlib.pyplot.contour) function is another way to represent -the same data: + 函数[``pcolormesh()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pcolormesh.html#matplotlib.pyplot.pcolormesh) 可以使用色彩来描绘横坐标间隔一致或不一致的二维向量。 + 函数[``contour()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.contour.html#matplotlib.pyplot.contour)与其类似:
@@ -65,10 +58,9 @@ the same data: **Example comparing [``pcolormesh()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pcolormesh.html#matplotlib.pyplot.pcolormesh) and [``contour()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.contour.html#matplotlib.pyplot.contour) for plotting two-dimensional data** -## Histograms +## 直方图 -The [``hist()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.hist.html#matplotlib.pyplot.hist) function automatically generates -histograms and returns the bin counts or probabilities: +函数 [``hist()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.hist.html#matplotlib.pyplot.hist) 自动生成直方图,并且返回每bin的数目或概率:
From 9a259a69a5ce81a34879eda3950101c5f4fa9e65 Mon Sep 17 00:00:00 2001 From: everyone is best one <37625649@qq.com> Date: Wed, 17 Jun 2020 11:45:40 +0800 Subject: [PATCH 2/7] Update sample_plots.md --- docs/tutorials/introductory/sample_plots.md | 54 ++++++++++----------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/docs/tutorials/introductory/sample_plots.md b/docs/tutorials/introductory/sample_plots.md index 4e751db..87024ac 100644 --- a/docs/tutorials/introductory/sample_plots.md +++ b/docs/tutorials/introductory/sample_plots.md @@ -5,7 +5,7 @@ sidebar: auto # 使用Matplotlib绘制简单图形 在此会提供很多图例以及绘制他们的代码. -## 折线图 +## 折线图(line plot) 创建带有文本标签的折线图 [``plot()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.plot.html#matplotlib.pyplot.plot). @@ -33,7 +33,7 @@ sidebar: auto

-## 图像 +## 图像显示(image) 可以使用 [``imshow()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.imshow.html#matplotlib.pyplot.imshow) 函数来显示图像. @@ -58,7 +58,7 @@ sidebar: auto **Example comparing [``pcolormesh()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pcolormesh.html#matplotlib.pyplot.pcolormesh) and [``contour()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.contour.html#matplotlib.pyplot.contour) for plotting two-dimensional data** -## 直方图 +## 直方图(Histogram) 函数 [``hist()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.hist.html#matplotlib.pyplot.hist) 自动生成直方图,并且返回每bin的数目或概率: @@ -71,10 +71,9 @@ sidebar: auto

-## Paths +## 路径(Paths) -You can add arbitrary paths in Matplotlib using the -[``matplotlib.path``](https://matplotlib.org/api/path_api.html#module-matplotlib.path) module: +[``matplotlib.path``](https://matplotlib.org/api/path_api.html#module-matplotlib.path) 模块添加各种路径到Matplotlib中:
@@ -85,11 +84,9 @@ You can add arbitrary paths in Matplotlib using the

-## Three-dimensional plotting +## 绘制三维图表 -The mplot3d toolkit (see [Getting started](https://matplotlib.org//toolkits/mplot3d.html#toolkit-mplot3d-tutorial) and -[3D plotting](https://matplotlib.org/gallery/index.html#mplot3d-examples-index)) has support for simple 3d graphs -including surface, wireframe, scatter, and bar charts. +matpltlib三维工具箱(The mplot3d toolkit)能够支持简单的三维图表,其中包括曲面图,线框图,散点图与条形图。 (详见 [Getting started](https://matplotlib.org//toolkits/mplot3d.html#toolkit-mplot3d-tutorial) 与[3D plotting](https://matplotlib.org/gallery/index.html#mplot3d-examples-index))
@@ -100,11 +97,10 @@ including surface, wireframe, scatter, and bar charts.

-Thanks to John Porter, Jonathon Taylor, Reinier Heeres, and Ben Root for -the ``mplot3d`` toolkit. This toolkit is included with all standard Matplotlib -installs. +感谢John Porter, Jonathon Taylor, Reinier Heeres, 与 Ben Root 对 +``mplot3d``所做出的贡献 . 该工具箱在所有完整版的matpltlib中均已包含,无需再次安装. -## Streamplot +## 流量图(Streamplot) The [``streamplot()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.streamplot.html#matplotlib.pyplot.streamplot) function plots the streamlines of a vector field. In addition to simply plotting the streamlines, it allows you @@ -124,7 +120,7 @@ This feature complements the [``quiver()``](https://matplotlib.org/api/_as_gen/m plotting vector fields. Thanks to Tom Flannaghan and Tony Yu for adding the streamplot function. -## Ellipses +## 椭圆(Ellipses) In support of the [Phoenix](http://www.jpl.nasa.gov/news/phoenix/main.php) mission to Mars (which used Matplotlib to display ground tracking of @@ -141,7 +137,7 @@ an extremely accurate 8-spline approximation to elliptical arcs (see

-## Bar charts +## 条形图(Bar charts) Use the [``bar()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.bar.html#matplotlib.pyplot.bar) function to make bar charts, which includes customizations such as error bars: @@ -160,7 +156,7 @@ You can also create stacked bars or horizontal bar charts ([barh.py](https://matplotlib.org/gallery/lines_bars_and_markers/barh.html)). -## Pie charts +## 饼图(Pie charts) The [``pie()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pie.html#matplotlib.pyplot.pie) function allows you to create pie charts. Optional features include auto-labeling the percentage of area, @@ -177,7 +173,7 @@ a few lines of code.

-## Tables +## 表格(Tables) The [``table()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.table.html#matplotlib.pyplot.table) function adds a text table to an axes. @@ -191,7 +187,7 @@ to an axes.

-## Scatter plots +## 散点图(Scatter plots) The [``scatter()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.scatter.html#matplotlib.pyplot.scatter) function makes a scatter plot with (optional) size and color arguments. This example plots changes @@ -208,7 +204,7 @@ alpha attribute is used to make semitransparent circle markers.

-## GUI widgets +## 图形界面控件(GUI widgets) Matplotlib has basic GUI widgets that are independent of the graphical user interface you are using, allowing you to write cross GUI figures @@ -224,7 +220,7 @@ and widgets. See [``matplotlib.widgets``](https://matplotlib.org/api/widgets_api

-## Filled curves +## 曲线色彩填充(Filled curves) The [``fill()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.fill.html#matplotlib.pyplot.fill) function lets you plot filled curves and polygons: @@ -240,7 +236,7 @@ plot filled curves and polygons: Thanks to Andrew Straw for adding this function. -## Date handling +## 时间处理(Date handling) You can plot timeseries data with major and minor ticks and custom tick formatters for both. @@ -256,7 +252,7 @@ tick formatters for both. See [``matplotlib.ticker``](https://matplotlib.org/api/ticker_api.html#module-matplotlib.ticker) and [``matplotlib.dates``](https://matplotlib.org/api/dates_api.html#module-matplotlib.dates) for details and usage. -## Log plots +## 对数图(Log plots) The [``semilogx()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.semilogx.html#matplotlib.pyplot.semilogx), [``semilogy()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.semilogy.html#matplotlib.pyplot.semilogy) and @@ -275,7 +271,7 @@ logarithmic plots. Thanks to Andrew Straw, Darren Dale and Gregory Lielens for contributions log-scaling infrastructure. -## Polar plots +## 极坐标图(Polar plots) The [``polar()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.polar.html#matplotlib.pyplot.polar) function generates polar plots. @@ -288,7 +284,7 @@ The [``polar()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.polar.htm

-## Legends +## 图例(Legends) The [``legend()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.legend.html#matplotlib.pyplot.legend) function automatically generates figure legends, with MATLAB-compatible legend-placement @@ -305,7 +301,7 @@ functions. Thanks to Charles Twardy for input on the legend function. -## TeX-notation for text objects +## 文本对象的Tex表示法(TeX-notation for text objects) Below is a sampling of the many TeX expressions now supported by Matplotlib's internal mathtext engine. The mathtext module provides TeX style mathematical @@ -326,7 +322,7 @@ Matplotlib's mathtext infrastructure is an independent implementation and does not require TeX or any external packages installed on your computer. See the tutorial at [Writing mathematical expressions](https://matplotlib.org//text/mathtext.html). -## Native TeX rendering +## 原生Tex渲染(Native TeX rendering) Although Matplotlib's internal math rendering engine is quite powerful, sometimes you need TeX. Matplotlib supports external TeX @@ -372,7 +368,7 @@ Just for fun, Matplotlib supports plotting in the style of ``xkcd``.

-## Subplot example +## 子图实例(Subplot example) Many plot types can be combined in one figure to create powerful and flexible representations of data. @@ -397,7 +393,7 @@ axs[1, 1].hist2d(data[0], data[1]) plt.show() ``` -## Download +## 下载(Download) - [Download Python source code: sample_plots.py](https://matplotlib.org/_downloads/6b0f2d1b3dc8d0e75eaa96feb738e947/sample_plots.py) - [Download Jupyter notebook: sample_plots.ipynb](https://matplotlib.org/_downloads/dcfd63fc031d50e9c085f5dc4aa458b1/sample_plots.ipynb) From 7c4c25f9fad24f5b9c4928e5f2584b0e67c85e92 Mon Sep 17 00:00:00 2001 From: everyone is best one <37625649@qq.com> Date: Wed, 17 Jun 2020 12:47:29 +0800 Subject: [PATCH 3/7] Update sample_plots.md --- docs/tutorials/introductory/sample_plots.md | 28 ++++++--------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/docs/tutorials/introductory/sample_plots.md b/docs/tutorials/introductory/sample_plots.md index 87024ac..7ae4599 100644 --- a/docs/tutorials/introductory/sample_plots.md +++ b/docs/tutorials/introductory/sample_plots.md @@ -71,9 +71,9 @@ sidebar: auto

-## 路径(Paths) +## 折线轨迹(Paths) -[``matplotlib.path``](https://matplotlib.org/api/path_api.html#module-matplotlib.path) 模块添加各种路径到Matplotlib中: +matplotlib中用于折线处理的类主要是[``matplotlib.path``](https://matplotlib.org/api/path_api.html#module-matplotlib.path) ,几乎所有矢量绘图都在绘图管道(drawing pipeline)中使用了折线,虽然无法绘制path实例本身,但也可以使其可视化:
@@ -102,10 +102,7 @@ matpltlib三维工具箱(The mplot3d toolkit)能够支持简单的三维图表 ## 流量图(Streamplot) -The [``streamplot()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.streamplot.html#matplotlib.pyplot.streamplot) function plots the streamlines of -a vector field. In addition to simply plotting the streamlines, it allows you -to map the colors and/or line widths of streamlines to a separate parameter, -such as the speed or local intensity of the vector field. +函数[``streamplot()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.streamplot.html#matplotlib.pyplot.streamplot)绘制向量场的流量图. 除了简单的绘制流线外, 它还允许您将流线的颜色和(或)线宽映射到单独的参数,例如矢量场的速度或局部强度。
@@ -122,11 +119,7 @@ streamplot function. ## 椭圆(Ellipses) -In support of the [Phoenix](http://www.jpl.nasa.gov/news/phoenix/main.php) -mission to Mars (which used Matplotlib to display ground tracking of -spacecraft), Michael Droettboom built on work by Charlie Moad to provide -an extremely accurate 8-spline approximation to elliptical arcs (see -[``Arc``](https://matplotlib.org/api/_as_gen/matplotlib.patches.Arc.html#matplotlib.patches.Arc)), which are insensitive to zoom level. +为了凤凰号火星任务[Phoenix](http://www.jpl.nasa.gov/news/phoenix/main.php)(使用matplolib做追踪航天器的地面站), 迈克尔·德罗特布姆(Michael Droettboom)以查理·莫阿德(Charlie Moad)的作品为基础,为椭圆弧提供了极其精确的8样条近似(详见[``Arc``](https://matplotlib.org/api/_as_gen/matplotlib.patches.Arc.html#matplotlib.patches.Arc)), 其对对缩放级别不敏感.
@@ -139,8 +132,7 @@ an extremely accurate 8-spline approximation to elliptical arcs (see ## 条形图(Bar charts) -Use the [``bar()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.bar.html#matplotlib.pyplot.bar) function to make bar charts, which -includes customizations such as error bars: +使用 [``bar()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.bar.html#matplotlib.pyplot.bar) 函数来创建一个条形图, 其中包括自定义设置,例如错误栏:
@@ -151,18 +143,14 @@ includes customizations such as error bars:

-You can also create stacked bars +你也可以创建多分类累计柱状图(stacked bars) ([bar_stacked.py](https://matplotlib.org/gallery/lines_bars_and_markers/bar_stacked.html)), -or horizontal bar charts +或是水平条状态(horizontal bar charts) ([barh.py](https://matplotlib.org/gallery/lines_bars_and_markers/barh.html)). ## 饼图(Pie charts) -The [``pie()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pie.html#matplotlib.pyplot.pie) function allows you to create pie -charts. Optional features include auto-labeling the percentage of area, -exploding one or more wedges from the center of the pie, and a shadow effect. -Take a close look at the attached code, which generates this figure in just -a few lines of code. +函数[``pie()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pie.html#matplotlib.pyplot.pie) 可以创建一个饼图.可选功能包括自动标记面积百分比,从饼图中心爆炸一个或多个楔形以及阴影效果,只需几行代码即可生成此图形。
From 5583a366c88b0d055ec537569d95ad806bce2ab6 Mon Sep 17 00:00:00 2001 From: everyone is best one <37625649@qq.com> Date: Wed, 17 Jun 2020 14:19:59 +0800 Subject: [PATCH 4/7] Update sample_plots.md --- docs/tutorials/introductory/sample_plots.md | 76 +++++++-------------- 1 file changed, 26 insertions(+), 50 deletions(-) diff --git a/docs/tutorials/introductory/sample_plots.md b/docs/tutorials/introductory/sample_plots.md index 7ae4599..4a35944 100644 --- a/docs/tutorials/introductory/sample_plots.md +++ b/docs/tutorials/introductory/sample_plots.md @@ -119,7 +119,7 @@ streamplot function. ## 椭圆(Ellipses) -为了凤凰号火星任务[Phoenix](http://www.jpl.nasa.gov/news/phoenix/main.php)(使用matplolib做追踪航天器的地面站), 迈克尔·德罗特布姆(Michael Droettboom)以查理·莫阿德(Charlie Moad)的作品为基础,为椭圆弧提供了极其精确的8样条近似(详见[``Arc``](https://matplotlib.org/api/_as_gen/matplotlib.patches.Arc.html#matplotlib.patches.Arc)), 其对对缩放级别不敏感. +为了凤凰号火星任务[Phoenix](http://www.jpl.nasa.gov/news/phoenix/main.php)(使用matplolib做地面站追踪航天器), 迈克尔·德罗特布姆(Michael Droettboom)以查理·莫阿德(Charlie Moad)的作品为基础,为椭圆弧提供了极其精确的8样条近似(详见[``Arc``](https://matplotlib.org/api/_as_gen/matplotlib.patches.Arc.html#matplotlib.patches.Arc)), 这种椭圆弧其对缩放级别不敏感.
@@ -163,9 +163,7 @@ streamplot function. ## 表格(Tables) -The [``table()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.table.html#matplotlib.pyplot.table) function adds a text table -to an axes. - +函数[``table()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.table.html#matplotlib.pyplot.table) 添加表格到坐标轴上。
@@ -177,11 +175,7 @@ to an axes. ## 散点图(Scatter plots) -The [``scatter()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.scatter.html#matplotlib.pyplot.scatter) function makes a scatter plot -with (optional) size and color arguments. This example plots changes -in Google's stock price, with marker sizes reflecting the -trading volume and colors varying with time. Here, the -alpha attribute is used to make semitransparent circle markers. +函数 [``scatter()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.scatter.html#matplotlib.pyplot.scatter)用于绘制可设置大小及颜色的散点图,本示例绘制了Google股票价格的变化图,散点大小反映了交易量,颜色随时间变化,函数中的alpha为透明度。
@@ -194,9 +188,7 @@ alpha attribute is used to make semitransparent circle markers. ## 图形界面控件(GUI widgets) -Matplotlib has basic GUI widgets that are independent of the graphical -user interface you are using, allowing you to write cross GUI figures -and widgets. See [``matplotlib.widgets``](https://matplotlib.org/api/widgets_api.html#module-matplotlib.widgets) and the +Matplotlib提供了一些基本的独立于用户所使用的交互界面的GUI控件, 供用户跨GUI绘图. 详见 [``matplotlib.widgets``](https://matplotlib.org/api/widgets_api.html#module-matplotlib.widgets) 与 [widget examples](https://matplotlib.org/gallery/index.html).
@@ -210,8 +202,7 @@ and widgets. See [``matplotlib.widgets``](https://matplotlib.org/api/widgets_api ## 曲线色彩填充(Filled curves) -The [``fill()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.fill.html#matplotlib.pyplot.fill) function lets you -plot filled curves and polygons: +函数 [``fill()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.fill.html#matplotlib.pyplot.fill) 可以让你填充曲线与多边形:
@@ -222,12 +213,11 @@ plot filled curves and polygons:

-Thanks to Andrew Straw for adding this function. +感谢 Andrew Straw 添加了这个函数. ## 时间处理(Date handling) -You can plot timeseries data with major and minor ticks and custom -tick formatters for both. +你可以绘制可设置主次刻度的时间序列。
@@ -238,14 +228,13 @@ tick formatters for both.

-See [``matplotlib.ticker``](https://matplotlib.org/api/ticker_api.html#module-matplotlib.ticker) and [``matplotlib.dates``](https://matplotlib.org/api/dates_api.html#module-matplotlib.dates) for details and usage. +详见 [``matplotlib.ticker``](https://matplotlib.org/api/ticker_api.html#module-matplotlib.ticker) and [``matplotlib.dates``](https://matplotlib.org/api/dates_api.html#module-matplotlib.dates). ## 对数图(Log plots) -The [``semilogx()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.semilogx.html#matplotlib.pyplot.semilogx), -[``semilogy()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.semilogy.html#matplotlib.pyplot.semilogy) and -[``loglog()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.loglog.html#matplotlib.pyplot.loglog) functions simplify the creation of -logarithmic plots. +函数 [``semilogx()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.semilogx.html#matplotlib.pyplot.semilogx), +[``semilogy()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.semilogy.html#matplotlib.pyplot.semilogy) 与 +[``loglog()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.loglog.html#matplotlib.pyplot.loglog) 简化了对数图的创建。
@@ -256,12 +245,11 @@ logarithmic plots.

-Thanks to Andrew Straw, Darren Dale and Gregory Lielens for contributions -log-scaling infrastructure. +感谢 Andrew Straw, Darren Dale 与 Gregory Lielens 对log-scaling infrastructure的贡献. ## 极坐标图(Polar plots) -The [``polar()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.polar.html#matplotlib.pyplot.polar) function generates polar plots. +函数 [``polar()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.polar.html#matplotlib.pyplot.polar) 可生成极坐标图.
@@ -274,9 +262,7 @@ The [``polar()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.polar.htm ## 图例(Legends) -The [``legend()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.legend.html#matplotlib.pyplot.legend) function automatically -generates figure legends, with MATLAB-compatible legend-placement -functions. +函数 [``legend()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.legend.html#matplotlib.pyplot.legend) 使用了MATLAB-compatible legend-placement自动生成图例
@@ -287,15 +273,11 @@ functions.

-Thanks to Charles Twardy for input on the legend function. +感谢 Charles Twardy 添加 legend 函数. ## 文本对象的Tex表示法(TeX-notation for text objects) -Below is a sampling of the many TeX expressions now supported by Matplotlib's -internal mathtext engine. The mathtext module provides TeX style mathematical -expressions using [FreeType](https://www.freetype.org/) -and the DejaVu, BaKoMa computer modern, or [STIX](http://www.stixfonts.org) -fonts. See the [``matplotlib.mathtext``](https://matplotlib.org/api/mathtext_api.html#module-matplotlib.mathtext) module for additional details. +下面是Matplotlib的mathtext引擎当前支持的许多TeX表达式的示例。它使用了[FreeType](https://www.freetype.org/)与DejaVu, BaKoMa computer modern, 以及 [STIX](http://www.stixfonts.org),详见 [``matplotlib.mathtext``](https://matplotlib.org/api/mathtext_api.html#module-matplotlib.mathtext).
@@ -306,15 +288,11 @@ fonts. See the [``matplotlib.mathtext``](https://matplotlib.org/api/mathtext_api

-Matplotlib's mathtext infrastructure is an independent implementation and -does not require TeX or any external packages installed on your computer. See -the tutorial at [Writing mathematical expressions](https://matplotlib.org//text/mathtext.html). +Matplotlib的mathtext架构的实现是独立的,不依赖于 TeX or 以及其他需要安装到电脑的包. 教程详见 [Writing mathematical expressions](https://matplotlib.org//text/mathtext.html). ## 原生Tex渲染(Native TeX rendering) -Although Matplotlib's internal math rendering engine is quite -powerful, sometimes you need TeX. Matplotlib supports external TeX -rendering of strings with the *usetex* option. +尽管Matplotlib原生的渲染引擎已非常强大,但有时你还可能需要TeX. Matplotlib可通过 *usetex*选项支持第三方TeX字符渲染。
@@ -325,17 +303,16 @@ rendering of strings with the *usetex* option.

-## EEG GUI +## 脑电图图形界面(EEG GUI) -You can embed Matplotlib into pygtk, wx, Tk, or Qt applications. -Here is a screenshot of an EEG viewer called [pbrain](https://github.com/nipy/pbrain). +你可以将Matplotlib的界面插入到pygtk, wx, Tk, Qt,PyQt中去.以下是EEG界面[pbrain](https://github.com/nipy/pbrain)的截图。 ![eeg_small](https://matplotlib.org/_images/eeg_small.png) -The lower axes uses [``specgram()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.specgram.html#matplotlib.pyplot.specgram) -to plot the spectrogram of one of the EEG channels. +下方的数轴使用了 [``specgram()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.specgram.html#matplotlib.pyplot.specgram) +绘制了脑电图的一个通道的频谱图。 -For examples of how to embed Matplotlib in different toolkits, see: +以下是将Matplotlib插入到不同界面的方式: - [Embedding in GTK3](https://matplotlib.org/gallery/user_interfaces/embedding_in_gtk3_sgskip.html) - [Embedding in wx #2](https://matplotlib.org/gallery/user_interfaces/embedding_in_wx2_sgskip.html) @@ -343,9 +320,9 @@ For examples of how to embed Matplotlib in different toolkits, see: - [Embedding in Qt](https://matplotlib.org/gallery/user_interfaces/embedding_in_qt_sgskip.html) - [Embedding in Tk](https://matplotlib.org/gallery/user_interfaces/embedding_in_tk_sgskip.html) -## XKCD-style sketch plots +## XKCD风格草图绘制(XKCD-style sketch plots) -Just for fun, Matplotlib supports plotting in the style of ``xkcd``. +Matplotlib 支持名为 ``xkcd``的风格,不过这图没啥用,只能用来玩玩
@@ -358,8 +335,7 @@ Just for fun, Matplotlib supports plotting in the style of ``xkcd``. ## 子图实例(Subplot example) -Many plot types can be combined in one figure to create -powerful and flexible representations of data. +可以将不同的图组合到一个图中,以创建功能强大且灵活的数据表示形式。
From 53693ecf4c4e63bf1479593e372a62a30ae0e09d Mon Sep 17 00:00:00 2001 From: everyone is best one <37625649@qq.com> Date: Wed, 17 Jun 2020 14:54:05 +0800 Subject: [PATCH 5/7] Update sample_plots.md --- docs/tutorials/introductory/sample_plots.md | 51 ++++++++++----------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/docs/tutorials/introductory/sample_plots.md b/docs/tutorials/introductory/sample_plots.md index 4a35944..c97f89a 100644 --- a/docs/tutorials/introductory/sample_plots.md +++ b/docs/tutorials/introductory/sample_plots.md @@ -15,7 +15,7 @@ sidebar: auto

- Simple Plot + 简单绘图

@@ -29,7 +29,7 @@ sidebar: auto

- Subplot + 子图

@@ -67,7 +67,7 @@ sidebar: auto

- Histogram Features + 直方图

@@ -80,7 +80,7 @@ matplotlib中用于折线处理的类主要是[``matplotlib.path``](https://matp

- Path Patch + 轨迹绘制

@@ -93,7 +93,7 @@ matpltlib三维工具箱(The mplot3d toolkit)能够支持简单的三维图表

- Surface3d + 3维曲面

@@ -109,24 +109,23 @@ matpltlib三维工具箱(The mplot3d toolkit)能够支持简单的三维图表

- Streamplot with various plotting options. + 流量图的各种类型.

-This feature complements the [``quiver()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.quiver.html#matplotlib.pyplot.quiver) function for -plotting vector fields. Thanks to Tom Flannaghan and Tony Yu for adding the -streamplot function. +该图为函数 [``quiver()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.quiver.html#matplotlib.pyplot.quiver) 提供了 +绘制向量场的功能,感谢Tom Flannaghan 与 Tony Yu. ## 椭圆(Ellipses) -为了凤凰号火星任务[Phoenix](http://www.jpl.nasa.gov/news/phoenix/main.php)(使用matplolib做地面站追踪航天器), 迈克尔·德罗特布姆(Michael Droettboom)以查理·莫阿德(Charlie Moad)的作品为基础,为椭圆弧提供了极其精确的8样条近似(详见[``Arc``](https://matplotlib.org/api/_as_gen/matplotlib.patches.Arc.html#matplotlib.patches.Arc)), 这种椭圆弧其对缩放级别不敏感. +迈克尔·德罗特布姆(Michael Droettboom)以查理·莫阿德(Charlie Moad)的作品为基础,为椭圆弧提供了极其精确的八次贝塞尔样条近似(eight cubic Bezier splines)(详见[``Arc``](https://matplotlib.org/api/_as_gen/matplotlib.patches.Arc.html#matplotlib.patches.Arc)), 这种椭圆弧其对缩放级别不敏感.

- Ellipse Demo + 椭圆展示

@@ -139,7 +138,7 @@ streamplot function.

- Barchart Demo + 条形图展示

@@ -157,7 +156,7 @@ streamplot function.

- Pie Features + 饼图展示

@@ -169,7 +168,7 @@ streamplot function.

- Table Demo + 表格展示

@@ -182,7 +181,7 @@ streamplot function.

- Scatter Demo2 + 散点图展示

@@ -196,11 +195,11 @@ Matplotlib提供了一些基本的独立于用户所使用的交互界面的GUI

- Slider and radio-button GUI. + 滑动条与播放旋钮.

-## 曲线色彩填充(Filled curves) +## 色彩填充(Filled curves) 函数 [``fill()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.fill.html#matplotlib.pyplot.fill) 可以让你填充曲线与多边形: @@ -209,7 +208,7 @@ Matplotlib提供了一些基本的独立于用户所使用的交互界面的GUI

- Fill + 填充

@@ -224,7 +223,7 @@ Matplotlib提供了一些基本的独立于用户所使用的交互界面的GUI

- Date + 时间序列

@@ -241,7 +240,7 @@ Matplotlib提供了一些基本的独立于用户所使用的交互界面的GUI

- Log Demo + 对数图展示

@@ -256,7 +255,7 @@ Matplotlib提供了一些基本的独立于用户所使用的交互界面的GUI

- Polar Demo + 极坐标图展示

@@ -269,13 +268,13 @@ Matplotlib提供了一些基本的独立于用户所使用的交互界面的GUI

- Legend + 图例

感谢 Charles Twardy 添加 legend 函数. -## 文本对象的Tex表示法(TeX-notation for text objects) +## 文本对象的TeX表示法(TeX-notation for text objects) 下面是Matplotlib的mathtext引擎当前支持的许多TeX表达式的示例。它使用了[FreeType](https://www.freetype.org/)与DejaVu, BaKoMa computer modern, 以及 [STIX](http://www.stixfonts.org),详见 [``matplotlib.mathtext``](https://matplotlib.org/api/mathtext_api.html#module-matplotlib.mathtext). @@ -284,13 +283,13 @@ Matplotlib提供了一些基本的独立于用户所使用的交互界面的GUI

- Mathtext Examples + Mathtext示例

Matplotlib的mathtext架构的实现是独立的,不依赖于 TeX or 以及其他需要安装到电脑的包. 教程详见 [Writing mathematical expressions](https://matplotlib.org//text/mathtext.html). -## 原生Tex渲染(Native TeX rendering) +## 原生TeX渲染(Native TeX rendering) 尽管Matplotlib原生的渲染引擎已非常强大,但有时你还可能需要TeX. Matplotlib可通过 *usetex*选项支持第三方TeX字符渲染。 @@ -299,7 +298,7 @@ Matplotlib的mathtext架构的实现是独立的,不依赖于 TeX or 以及其

- Tex Demo + TeX 展示

From 58c2d027019e8e5d98f1a6c3a07bfb3616bc3f25 Mon Sep 17 00:00:00 2001 From: everyone is best one <37625649@qq.com> Date: Wed, 17 Jun 2020 15:34:57 +0800 Subject: [PATCH 6/7] Update sample_plots.md --- docs/tutorials/introductory/sample_plots.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/docs/tutorials/introductory/sample_plots.md b/docs/tutorials/introductory/sample_plots.md index c97f89a..9e2e3cd 100644 --- a/docs/tutorials/introductory/sample_plots.md +++ b/docs/tutorials/introductory/sample_plots.md @@ -43,7 +43,7 @@ sidebar: auto -**Example of using [``imshow()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.imshow.html#matplotlib.pyplot.imshow) to display a CT scan** +**上图为使用[``imshow()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.imshow.html#matplotlib.pyplot.imshow)展示的CT图** ## 热力图(pcolormesh)与等高线(contour) @@ -56,7 +56,7 @@ sidebar: auto -**Example comparing [``pcolormesh()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pcolormesh.html#matplotlib.pyplot.pcolormesh) and [``contour()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.contour.html#matplotlib.pyplot.contour) for plotting two-dimensional data** +**[``pcolormesh()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pcolormesh.html#matplotlib.pyplot.pcolormesh) 与[``contour()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.contour.html#matplotlib.pyplot.contour)的比较** ## 直方图(Histogram) @@ -113,8 +113,7 @@ matpltlib三维工具箱(The mplot3d toolkit)能够支持简单的三维图表

-该图为函数 [``quiver()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.quiver.html#matplotlib.pyplot.quiver) 提供了 -绘制向量场的功能,感谢Tom Flannaghan 与 Tony Yu. +感谢Tom Flannaghan 与 Tony Yu 为[``quiver()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.quiver.html#matplotlib.pyplot.quiver) 提供了绘制向量场的功能. ## 椭圆(Ellipses) @@ -276,7 +275,7 @@ Matplotlib提供了一些基本的独立于用户所使用的交互界面的GUI ## 文本对象的TeX表示法(TeX-notation for text objects) -下面是Matplotlib的mathtext引擎当前支持的许多TeX表达式的示例。它使用了[FreeType](https://www.freetype.org/)与DejaVu, BaKoMa computer modern, 以及 [STIX](http://www.stixfonts.org),详见 [``matplotlib.mathtext``](https://matplotlib.org/api/mathtext_api.html#module-matplotlib.mathtext). +下面是Matplotlib的mathtext引擎当前支持的TeX表达式的示例。它使用了[FreeType](https://www.freetype.org/)与DejaVu, BaKoMa computer modern, 以及 [STIX](http://www.stixfonts.org),详见 [``matplotlib.mathtext``](https://matplotlib.org/api/mathtext_api.html#module-matplotlib.mathtext).
@@ -287,7 +286,7 @@ Matplotlib提供了一些基本的独立于用户所使用的交互界面的GUI

-Matplotlib的mathtext架构的实现是独立的,不依赖于 TeX or 以及其他需要安装到电脑的包. 教程详见 [Writing mathematical expressions](https://matplotlib.org//text/mathtext.html). +Matplotlib的mathtext架构的实现是独立的,不依赖于 TeX 以及其他需要安装到电脑的包. 教程详见 [Writing mathematical expressions](https://matplotlib.org//text/mathtext.html). ## 原生TeX渲染(Native TeX rendering) @@ -308,8 +307,8 @@ Matplotlib的mathtext架构的实现是独立的,不依赖于 TeX or 以及其 ![eeg_small](https://matplotlib.org/_images/eeg_small.png) -下方的数轴使用了 [``specgram()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.specgram.html#matplotlib.pyplot.specgram) -绘制了脑电图的一个通道的频谱图。 +最下方的图像是使用 [``specgram()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.specgram.html#matplotlib.pyplot.specgram) +绘制的脑电图的一个通道的频谱图。 以下是将Matplotlib插入到不同界面的方式: From 2fac414517023eede2afbc8dcc500253bbcc8fc4 Mon Sep 17 00:00:00 2001 From: everyone is best one <37625649@qq.com> Date: Wed, 17 Jun 2020 11:04:32 +0800 Subject: [PATCH 7/7] Update sample_plots.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 汉化了一部分内容 Update sample_plots.md Update sample_plots.md Update sample_plots.md Update sample_plots.md Update sample_plots.md --- docs/tutorials/introductory/sample_plots.md | 228 ++++++++------------ 1 file changed, 89 insertions(+), 139 deletions(-) diff --git a/docs/tutorials/introductory/sample_plots.md b/docs/tutorials/introductory/sample_plots.md index 436daf2..9e2e3cd 100644 --- a/docs/tutorials/introductory/sample_plots.md +++ b/docs/tutorials/introductory/sample_plots.md @@ -2,15 +2,12 @@ sidebarDepth: 3 sidebar: auto --- +# 使用Matplotlib绘制简单图形 +在此会提供很多图例以及绘制他们的代码. -# Sample plots in Matplotlib +## 折线图(line plot) -Here you'll find a host of example plots with the code that -generated them. - -## Line Plot - -Here's how to create a line plot with text labels using +创建带有文本标签的折线图 [``plot()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.plot.html#matplotlib.pyplot.plot).
@@ -18,28 +15,27 @@ Here's how to create a line plot with text labels using

- Simple Plot + 简单绘图

-## Multiple subplots in one figure +## 一个图(figure)中含多个子图(subplots) -Multiple axes (i.e. subplots) are created with the -[``subplot()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplot.html#matplotlib.pyplot.subplot) function: +多子图使用 +[``subplot()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplot.html#matplotlib.pyplot.subplot) 函数创建:

- Subplot + 子图

-## Images +## 图像显示(image) -Matplotlib can display images (assuming equally spaced -horizontal dimensions) using the [``imshow()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.imshow.html#matplotlib.pyplot.imshow) function. +可以使用 [``imshow()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.imshow.html#matplotlib.pyplot.imshow) 函数来显示图像.
@@ -47,15 +43,12 @@ horizontal dimensions) using the [``imshow()``](https://matplotlib.org/api/_as_g
-**Example of using [``imshow()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.imshow.html#matplotlib.pyplot.imshow) to display a CT scan** +**上图为使用[``imshow()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.imshow.html#matplotlib.pyplot.imshow)展示的CT图** -## Contouring and pseudocolor +## 热力图(pcolormesh)与等高线(contour) -The [``pcolormesh()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pcolormesh.html#matplotlib.pyplot.pcolormesh) function can make a colored -representation of a two-dimensional array, even if the horizontal dimensions -are unevenly spaced. The -[``contour()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.contour.html#matplotlib.pyplot.contour) function is another way to represent -the same data: + 函数[``pcolormesh()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pcolormesh.html#matplotlib.pyplot.pcolormesh) 可以使用色彩来描绘横坐标间隔一致或不一致的二维向量。 + 函数[``contour()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.contour.html#matplotlib.pyplot.contour)与其类似:
@@ -63,164 +56,137 @@ the same data:
-**Example comparing [``pcolormesh()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pcolormesh.html#matplotlib.pyplot.pcolormesh) and [``contour()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.contour.html#matplotlib.pyplot.contour) for plotting two-dimensional data** +**[``pcolormesh()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pcolormesh.html#matplotlib.pyplot.pcolormesh) 与[``contour()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.contour.html#matplotlib.pyplot.contour)的比较** -## Histograms +## 直方图(Histogram) -The [``hist()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.hist.html#matplotlib.pyplot.hist) function automatically generates -histograms and returns the bin counts or probabilities: +函数 [``hist()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.hist.html#matplotlib.pyplot.hist) 自动生成直方图,并且返回每bin的数目或概率:

- Histogram Features + 直方图

-## Paths +## 折线轨迹(Paths) -You can add arbitrary paths in Matplotlib using the -[``matplotlib.path``](https://matplotlib.org/api/path_api.html#module-matplotlib.path) module: +matplotlib中用于折线处理的类主要是[``matplotlib.path``](https://matplotlib.org/api/path_api.html#module-matplotlib.path) ,几乎所有矢量绘图都在绘图管道(drawing pipeline)中使用了折线,虽然无法绘制path实例本身,但也可以使其可视化:

- Path Patch + 轨迹绘制

-## Three-dimensional plotting +## 绘制三维图表 -The mplot3d toolkit (see [Getting started](https://matplotlib.org//toolkits/mplot3d.html#toolkit-mplot3d-tutorial) and -[3D plotting](https://matplotlib.org/gallery/index.html#mplot3d-examples-index)) has support for simple 3d graphs -including surface, wireframe, scatter, and bar charts. +matpltlib三维工具箱(The mplot3d toolkit)能够支持简单的三维图表,其中包括曲面图,线框图,散点图与条形图。 (详见 [Getting started](https://matplotlib.org//toolkits/mplot3d.html#toolkit-mplot3d-tutorial) 与[3D plotting](https://matplotlib.org/gallery/index.html#mplot3d-examples-index))

- Surface3d + 3维曲面

-Thanks to John Porter, Jonathon Taylor, Reinier Heeres, and Ben Root for -the ``mplot3d`` toolkit. This toolkit is included with all standard Matplotlib -installs. +感谢John Porter, Jonathon Taylor, Reinier Heeres, 与 Ben Root 对 +``mplot3d``所做出的贡献 . 该工具箱在所有完整版的matpltlib中均已包含,无需再次安装. -## Streamplot +## 流量图(Streamplot) -The [``streamplot()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.streamplot.html#matplotlib.pyplot.streamplot) function plots the streamlines of -a vector field. In addition to simply plotting the streamlines, it allows you -to map the colors and/or line widths of streamlines to a separate parameter, -such as the speed or local intensity of the vector field. +函数[``streamplot()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.streamplot.html#matplotlib.pyplot.streamplot)绘制向量场的流量图. 除了简单的绘制流线外, 它还允许您将流线的颜色和(或)线宽映射到单独的参数,例如矢量场的速度或局部强度。

- Streamplot with various plotting options. + 流量图的各种类型.

-This feature complements the [``quiver()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.quiver.html#matplotlib.pyplot.quiver) function for -plotting vector fields. Thanks to Tom Flannaghan and Tony Yu for adding the -streamplot function. +感谢Tom Flannaghan 与 Tony Yu 为[``quiver()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.quiver.html#matplotlib.pyplot.quiver) 提供了绘制向量场的功能. -## Ellipses +## 椭圆(Ellipses) -In support of the [Phoenix](http://www.jpl.nasa.gov/news/phoenix/main.php) -mission to Mars (which used Matplotlib to display ground tracking of -spacecraft), Michael Droettboom built on work by Charlie Moad to provide -an extremely accurate 8-spline approximation to elliptical arcs (see -[``Arc``](https://matplotlib.org/api/_as_gen/matplotlib.patches.Arc.html#matplotlib.patches.Arc)), which are insensitive to zoom level. +迈克尔·德罗特布姆(Michael Droettboom)以查理·莫阿德(Charlie Moad)的作品为基础,为椭圆弧提供了极其精确的八次贝塞尔样条近似(eight cubic Bezier splines)(详见[``Arc``](https://matplotlib.org/api/_as_gen/matplotlib.patches.Arc.html#matplotlib.patches.Arc)), 这种椭圆弧其对缩放级别不敏感.

- Ellipse Demo + 椭圆展示

-## Bar charts +## 条形图(Bar charts) -Use the [``bar()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.bar.html#matplotlib.pyplot.bar) function to make bar charts, which -includes customizations such as error bars: +使用 [``bar()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.bar.html#matplotlib.pyplot.bar) 函数来创建一个条形图, 其中包括自定义设置,例如错误栏:

- Barchart Demo + 条形图展示

-You can also create stacked bars +你也可以创建多分类累计柱状图(stacked bars) ([bar_stacked.py](https://matplotlib.org/gallery/lines_bars_and_markers/bar_stacked.html)), -or horizontal bar charts +或是水平条状态(horizontal bar charts) ([barh.py](https://matplotlib.org/gallery/lines_bars_and_markers/barh.html)). -## Pie charts +## 饼图(Pie charts) -The [``pie()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pie.html#matplotlib.pyplot.pie) function allows you to create pie -charts. Optional features include auto-labeling the percentage of area, -exploding one or more wedges from the center of the pie, and a shadow effect. -Take a close look at the attached code, which generates this figure in just -a few lines of code. +函数[``pie()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pie.html#matplotlib.pyplot.pie) 可以创建一个饼图.可选功能包括自动标记面积百分比,从饼图中心爆炸一个或多个楔形以及阴影效果,只需几行代码即可生成此图形。

- Pie Features + 饼图展示

-## Tables - -The [``table()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.table.html#matplotlib.pyplot.table) function adds a text table -to an axes. +## 表格(Tables) +函数[``table()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.table.html#matplotlib.pyplot.table) 添加表格到坐标轴上。

- Table Demo + 表格展示

-## Scatter plots +## 散点图(Scatter plots) -The [``scatter()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.scatter.html#matplotlib.pyplot.scatter) function makes a scatter plot -with (optional) size and color arguments. This example plots changes -in Google's stock price, with marker sizes reflecting the -trading volume and colors varying with time. Here, the -alpha attribute is used to make semitransparent circle markers. +函数 [``scatter()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.scatter.html#matplotlib.pyplot.scatter)用于绘制可设置大小及颜色的散点图,本示例绘制了Google股票价格的变化图,散点大小反映了交易量,颜色随时间变化,函数中的alpha为透明度。

- Scatter Demo2 + 散点图展示

-## GUI widgets +## 图形界面控件(GUI widgets) -Matplotlib has basic GUI widgets that are independent of the graphical -user interface you are using, allowing you to write cross GUI figures -and widgets. See [``matplotlib.widgets``](https://matplotlib.org/api/widgets_api.html#module-matplotlib.widgets) and the +Matplotlib提供了一些基本的独立于用户所使用的交互界面的GUI控件, 供用户跨GUI绘图. 详见 [``matplotlib.widgets``](https://matplotlib.org/api/widgets_api.html#module-matplotlib.widgets) 与 [widget examples](https://matplotlib.org/gallery/index.html).
@@ -228,138 +194,123 @@ and widgets. See [``matplotlib.widgets``](https://matplotlib.org/api/widgets_api

- Slider and radio-button GUI. + 滑动条与播放旋钮.

-## Filled curves +## 色彩填充(Filled curves) -The [``fill()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.fill.html#matplotlib.pyplot.fill) function lets you -plot filled curves and polygons: +函数 [``fill()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.fill.html#matplotlib.pyplot.fill) 可以让你填充曲线与多边形:

- Fill + 填充

-Thanks to Andrew Straw for adding this function. +感谢 Andrew Straw 添加了这个函数. -## Date handling +## 时间处理(Date handling) -You can plot timeseries data with major and minor ticks and custom -tick formatters for both. +你可以绘制可设置主次刻度的时间序列。

- Date + 时间序列

-See [``matplotlib.ticker``](https://matplotlib.org/api/ticker_api.html#module-matplotlib.ticker) and [``matplotlib.dates``](https://matplotlib.org/api/dates_api.html#module-matplotlib.dates) for details and usage. +详见 [``matplotlib.ticker``](https://matplotlib.org/api/ticker_api.html#module-matplotlib.ticker) and [``matplotlib.dates``](https://matplotlib.org/api/dates_api.html#module-matplotlib.dates). -## Log plots +## 对数图(Log plots) -The [``semilogx()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.semilogx.html#matplotlib.pyplot.semilogx), -[``semilogy()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.semilogy.html#matplotlib.pyplot.semilogy) and -[``loglog()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.loglog.html#matplotlib.pyplot.loglog) functions simplify the creation of -logarithmic plots. +函数 [``semilogx()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.semilogx.html#matplotlib.pyplot.semilogx), +[``semilogy()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.semilogy.html#matplotlib.pyplot.semilogy) 与 +[``loglog()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.loglog.html#matplotlib.pyplot.loglog) 简化了对数图的创建。

- Log Demo + 对数图展示

-Thanks to Andrew Straw, Darren Dale and Gregory Lielens for contributions -log-scaling infrastructure. +感谢 Andrew Straw, Darren Dale 与 Gregory Lielens 对log-scaling infrastructure的贡献. -## Polar plots +## 极坐标图(Polar plots) -The [``polar()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.polar.html#matplotlib.pyplot.polar) function generates polar plots. +函数 [``polar()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.polar.html#matplotlib.pyplot.polar) 可生成极坐标图.

- Polar Demo + 极坐标图展示

-## Legends +## 图例(Legends) -The [``legend()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.legend.html#matplotlib.pyplot.legend) function automatically -generates figure legends, with MATLAB-compatible legend-placement -functions. +函数 [``legend()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.legend.html#matplotlib.pyplot.legend) 使用了MATLAB-compatible legend-placement自动生成图例

- Legend + 图例

-Thanks to Charles Twardy for input on the legend function. +感谢 Charles Twardy 添加 legend 函数. -## TeX-notation for text objects +## 文本对象的TeX表示法(TeX-notation for text objects) -Below is a sampling of the many TeX expressions now supported by Matplotlib's -internal mathtext engine. The mathtext module provides TeX style mathematical -expressions using [FreeType](https://www.freetype.org/) -and the DejaVu, BaKoMa computer modern, or [STIX](http://www.stixfonts.org) -fonts. See the [``matplotlib.mathtext``](https://matplotlib.org/api/mathtext_api.html#module-matplotlib.mathtext) module for additional details. +下面是Matplotlib的mathtext引擎当前支持的TeX表达式的示例。它使用了[FreeType](https://www.freetype.org/)与DejaVu, BaKoMa computer modern, 以及 [STIX](http://www.stixfonts.org),详见 [``matplotlib.mathtext``](https://matplotlib.org/api/mathtext_api.html#module-matplotlib.mathtext).

- Mathtext Examples + Mathtext示例

-Matplotlib's mathtext infrastructure is an independent implementation and -does not require TeX or any external packages installed on your computer. See -the tutorial at [Writing mathematical expressions](https://matplotlib.org//text/mathtext.html). +Matplotlib的mathtext架构的实现是独立的,不依赖于 TeX 以及其他需要安装到电脑的包. 教程详见 [Writing mathematical expressions](https://matplotlib.org//text/mathtext.html). -## Native TeX rendering +## 原生TeX渲染(Native TeX rendering) -Although Matplotlib's internal math rendering engine is quite -powerful, sometimes you need TeX. Matplotlib supports external TeX -rendering of strings with the *usetex* option. +尽管Matplotlib原生的渲染引擎已非常强大,但有时你还可能需要TeX. Matplotlib可通过 *usetex*选项支持第三方TeX字符渲染。

- Tex Demo + TeX 展示

-## EEG GUI +## 脑电图图形界面(EEG GUI) -You can embed Matplotlib into pygtk, wx, Tk, or Qt applications. -Here is a screenshot of an EEG viewer called [pbrain](https://github.com/nipy/pbrain). +你可以将Matplotlib的界面插入到pygtk, wx, Tk, Qt,PyQt中去.以下是EEG界面[pbrain](https://github.com/nipy/pbrain)的截图。 ![eeg_small](https://matplotlib.org/_images/eeg_small.png) -The lower axes uses [``specgram()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.specgram.html#matplotlib.pyplot.specgram) -to plot the spectrogram of one of the EEG channels. +最下方的图像是使用 [``specgram()``](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.specgram.html#matplotlib.pyplot.specgram) +绘制的脑电图的一个通道的频谱图。 -For examples of how to embed Matplotlib in different toolkits, see: +以下是将Matplotlib插入到不同界面的方式: - [Embedding in GTK3](https://matplotlib.org/gallery/user_interfaces/embedding_in_gtk3_sgskip.html) - [Embedding in wx #2](https://matplotlib.org/gallery/user_interfaces/embedding_in_wx2_sgskip.html) @@ -367,9 +318,9 @@ For examples of how to embed Matplotlib in different toolkits, see: - [Embedding in Qt](https://matplotlib.org/gallery/user_interfaces/embedding_in_qt_sgskip.html) - [Embedding in Tk](https://matplotlib.org/gallery/user_interfaces/embedding_in_tk_sgskip.html) -## XKCD-style sketch plots +## XKCD风格草图绘制(XKCD-style sketch plots) -Just for fun, Matplotlib supports plotting in the style of ``xkcd``. +Matplotlib 支持名为 ``xkcd``的风格,不过这图没啥用,只能用来玩玩
@@ -380,10 +331,9 @@ Just for fun, Matplotlib supports plotting in the style of ``xkcd``.

-## Subplot example +## 子图实例(Subplot example) -Many plot types can be combined in one figure to create -powerful and flexible representations of data. +可以将不同的图组合到一个图中,以创建功能强大且灵活的数据表示形式。
@@ -405,7 +355,7 @@ axs[1, 1].hist2d(data[0], data[1]) plt.show() ``` -## Download +## 下载(Download) - [Download Python source code: sample_plots.py](https://matplotlib.org/_downloads/6b0f2d1b3dc8d0e75eaa96feb738e947/sample_plots.py) - [Download Jupyter notebook: sample_plots.ipynb](https://matplotlib.org/_downloads/dcfd63fc031d50e9c085f5dc4aa458b1/sample_plots.ipynb)