Skip to content

Commit

Permalink
m
Browse files Browse the repository at this point in the history
  • Loading branch information
cloga committed Jan 13, 2015
1 parent 278e35a commit 24409e8
Show file tree
Hide file tree
Showing 3 changed files with 216 additions and 10 deletions.
Binary file added .DS_Store
Binary file not shown.
59 changes: 55 additions & 4 deletions .ipynb_checkpoints/1.4Matplotlib:绘图-checkpoint.ipynb
@@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
"signature": "sha256:8529dfbc39d790fc903f601dbf7e0334d4bbde1466217f65a8f38fb23441f03c"
"signature": "sha256:2e070d5511d2148ef663412534a733587bcbd312785b0b8dda8012cdbad3f332"
},
"nbformat": 3,
"nbformat_minor": 0,
Expand Down Expand Up @@ -312,11 +312,62 @@
"**\u63d0\u793a**\uff1a\u6587\u6863\n",
"* [Artists](http://matplotlib.sourceforge.net/api/artist_api.html)\n",
"* [BBox](http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.text.Text.set_bbox)\n",
" The tick labels are now hardly visible because of the blue and red lines. We can make them bigger and we can also adjust their properties such that they\u2019ll be rendered on a semi-transparent white background. This will allow us to see both the data and the labels.\n",
"...\n",
"\n",
"\u56e0\u4e3a\u84dd\u8272\u548c\u7ea2\u8272\u7684\u7ebf\uff0c\u523b\u5ea6\u6807\u7b7e\u5f88\u96be\u770b\u5230\u3002\u6211\u4eec\u53ef\u4ee5\u8ba9\u4ed6\u4eec\u66f4\u5927\u4e00\u4e9b\uff0c\u4e5f\u53ef\u4ee5\u8c03\u6574\u4ed6\u4eec\u7684\u5c5e\u6027\u4ee5\u4fbf\u4ed6\u4eec\u88ab\u5904\u7406\u4e3a\u534a\u900f\u660e\u7684\u767d\u8272\u80cc\u666f\u3002\u8fd9\u6837\u6211\u4eec\u5c31\u53ef\u4ee5\u540c\u65f6\u770b\u5230\u6570\u636e\u548c\u6807\u7b7e\u3002\n",
"\n",
"```python\n",
"for label in ax.get_xticklabels() + ax.get_yticklabels():\n",
" label.set_fontsize(16)\n",
" label.set_bbox(dict(facecolor='white', edgecolor='None', alpha=0.65))\n"
" label.set_bbox(dict(facecolor='white', edgecolor='None', alpha=0.65))\n",
"```\n",
"\n",
"<a class=\"reference external image-reference\" href=\"http://scipy-lectures.github.io/intro/auto_examples/plot_exercice_10.html\"><img alt=\"plot_exercice_10_1.png\" class=\"align-right\" src=\"http://scipy-lectures.github.io/_images/plot_exercice_10_1.png\" style=\"width: 280.0px; height: 175.0px;\"></a>\n",
"\n",
"## 1.4.3 \u56fe\u5f62\u3001\u5b50\u56fe\u3001\u8f74\u548c\u523b\u5ea6\n",
"\n",
"\u5728matplotlib\u4e2d\u201c**\u56fe\u5f62**\u201d\u662f\u7528\u6237\u754c\u9762\u4e2d\u7684\u6574\u4e2a\u7a97\u53e3\u3002\u5728\u8fd9\u4e2a\u56fe\u5f62\u4e2d\u53ef\u4ee5\u6709\u201c**\u5b50\u56fe**\u201d\u3002\n",
"\n",
"\u5230\u76ee\u524d\u4e3a\u6b62\uff0c\u6211\u4eec\u5df2\u7ecf\u4f7f\u7528\u56fe\u5f62\u548c\u521b\u5efa\u6570\u8f74\u3002\u8fd9\u5bf9\u4e8e\u5feb\u901f\u7ed8\u56fe\u662f\u975e\u5e38\u65b9\u4fbf\u7684\u3002\u4f7f\u7528\u56fe\u5f62\u3001\u5b50\u56fe\u548c\u8f74\u6211\u4eec\u53ef\u4ee5\u63a7\u5236\u663e\u793a\u3002\u5c3d\u7ba1\u5b50\u56fe\u5c06\u56fe\u8868\u653e\u5728\u6807\u51c6\u7684\u7f51\u683c\u4e2d\uff0c\u8f74\u53ef\u4ee5\u5728\u56fe\u5f62\u4e2d\u653e\u5728\u4efb\u610f\u4f4d\u7f6e\u3002\u6839\u636e\u4f60\u7684\u76ee\u7684\u4e0d\u540c\uff0c\u4e8c\u8005\u90fd\u975e\u5e38\u6709\u7528\u3002\u6211\u4eec\u4e5f\u5728\u6ca1\u6709\u663e\u5f0f\u7684\u8c03\u7528\u56fe\u5f62\u548c\u5b50\u56fe\u65f6\u4f7f\u7528\u4e86\u4ed6\u4eec\u3002\u5f53\u6211\u4eec\u8c03\u7528plot\u65f6\uff0cmatplotlib\u8c03\u7528`gca()`\u6765\u83b7\u5f97\u5f53\u524d\u7684\u5750\u6807\u8f74\uff0c\u76f8\u5e94\u7684\u8c03\u7528`gcf()`\u83b7\u5f97\u5f53\u524d\u7684\u56fe\u5f62\u3002\u5982\u679c\u6ca1\u6709\u5f53\u524d\u56fe\u5f62\uff0c\u90a3\u4e48\u5c06\u8c03\u7528`figure()`\u53bb\u521b\u5efa\u4e00\u4e2a\uff0c\u4e25\u683c\u6765\u8bf4\u662f\u521b\u5efa\u4e00\u4e2a`subplot(111)\u3002\u8ba9\u6211\u4eec\u6765\u8be6\u7ec6\u770b\u4e00\u4e0b\u3002\n",
"\n",
"### 1.4.3.1 \u56fe\u5f62\n",
"\n",
"\u56fe\u5f62\u662f\u5728GUI\u4e2d\u7684\u7a97\u53e3\uff0c\u6807\u9898\u662f\"Figure #\"\u3002\u56fe\u5f62\u7684\u6807\u53f7\u4ece1\u5f00\u59cb\uff0c\u800c\u4e0d\u662f\u5e38\u89c4\u7684Python\u65b9\u5f0f\u4ece0\u5f00\u59cb\u3002\u8fd9\u660e\u663e\u662fMATLAB-\u98ce\u683c\u3002\u8fd9\u4e9b\u53c2\u6570\u51b3\u5b9a\u56fe\u5f62\u7684\u5916\u89c2\uff1a\n",
"\n",
"\u53c2\u6570|\u9ed8\u8ba4\u503c|\u63cf\u8ff0\n",
"--------|-------|-----------\n",
"num |1 |\u56fe\u5f62\u7f16\u53f7\n",
"figsize |figure.figsize|\u4ee5\u82f1\u5bf8\u8868\u793a\u7684\u56fe\u5f62\u5927\u5c0f\uff08\u5bbd\u3001\u9ad8\uff09\n",
"dpi |figure.dpi|\u5206\u8fa8\u7387\u4ee5\u6bcf\u82f1\u5bf8\u70b9\u6570\u8868\u793a\n",
"facecolor|figure.facecolor|\u80cc\u666f\u8272\n",
"edgecolor|figure.edgecolor|\u80cc\u666f\u8fb9\u7f18\u8272\n",
"frameon|True|\u662f\u5426\u7ed8\u5236\u6846\u67b6\n",
"\n",
"\u9ed8\u8ba4\u503c\u53ef\u4ee5\u5728\u8d44\u6e90\u6587\u4ef6\u4e2d\u6307\u660e\uff0c\u5e76\u5728\u7edd\u5927\u6570\u65f6\u95f4\u4f7f\u7528\u3002\u53ea\u6709\u56fe\u5f62\u6570\u7ecf\u5e38\u88ab\u6539\u53d8\u3002\n",
"\n",
"\u4e0e\u5176\u4ed6\u5bf9\u8c61\u7c7b\u4f3c\uff0c\u4f60\u53ef\u4ee5\u7528setp\u6216\u8005set_something\u65b9\u6cd5\u8bbe\u7f6e\u56fe\u5f62\u5c5e\u6027\u3002\n",
"\n",
"\u5f53\u4f60\u4f7f\u7528GUI\u5de5\u4f5c\u65f6\uff0c\u4f60\u53ef\u4ee5\u70b9\u51fb\u53f3\u4e0a\u7684X\u5173\u95ed\u56fe\u5f62\u3002\u4f46\u662f\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528close\u7528\u7a0b\u5e8f\u5173\u95ed\u56fe\u5f62\u3002\u6839\u636e\u53c2\u6570\u5173\u95ed\u4e0d\u540c\u5185\u5bb9\uff081\uff09\u5f53\u524d\u56fe\u5f62\uff08\u6ca1\u6709\u53c2\u6570\uff09\uff0c\uff082\uff09\u7279\u5b9a\u56fe\u5f62\uff08\u7528\u56fe\u5f62\u7f16\u53f7\u6216\u56fe\u5f62\u5b9e\u4f8b\u505a\u53c2\u6570\uff09\uff0c\uff083\uff09\u6240\u6709\u56fe\u5f62\uff08\"all\"\u4f5c\u4e3a\u53c2\u6570\uff09\u3002\n",
"\n",
"```python\n",
"pl.close(1) # Closes figure 1\n",
"```\n",
"\n",
"### 1.4.3.2 \u5b50\u56fe\n",
"\n",
"\u7528\u5b50\u56fe\u4f60\u53ef\u4ee5\u5c06\u56fe\u7247\u653e\u7f6e\u5728\u6807\u51c6\u65b9\u683c\u4e2d\u3002\u4f60\u9700\u8981\u6307\u5b9a\u884c\u5217\u6570\u548c\u56fe\u7247\u6570\u3002 \u6ce8\u610f[gridspec](http://matplotlib.org/users/gridspec.html)\u547d\u4ee4\u76f8\u5bf9\u66f4\u52a0\u9ad8\u7ea7\u3002\n",
"\n",
"<a class=\"reference external image-reference\" href=\"http://scipy-lectures.github.io/intro/auto_examples/plot_subplot-horizontal.html\"><img alt=\"plot_subplot-horizontal_1.png\" src=\"http://scipy-lectures.github.io/_images/plot_subplot-horizontal_1.png\" style=\"width: 168.0px; height: 112.0px;\"></a><a class=\"reference external image-reference\" href=\"http://scipy-lectures.github.io/intro/auto_examples/plot_subplot-vertical.html\"><img alt=\"plot_subplot-vertical_1.png\" src=\"http://scipy-lectures.github.io/_images/plot_subplot-vertical_1.png\" style=\"width: 168.0px; height: 112.0px;\"></a><a class=\"reference external image-reference\" href=\"http://scipy-lectures.github.io/intro/auto_examples/plot_subplot-grid.html\"><img alt=\"plot_subplot-grid_1.png\" src=\"http://scipy-lectures.github.io/_images/plot_subplot-grid_1.png\" style=\"width: 168.0px; height: 112.0px;\"></a><a class=\"reference external image-reference\" href=\"http://scipy-lectures.github.io/intro/auto_examples/plot_gridspec.html\"><img alt=\"plot_gridspec_1.png\" src=\"http://scipy-lectures.github.io/_images/plot_gridspec_1.png\" style=\"width: 168.0px; height: 112.0px;\"></a>\n",
"\n",
"\n",
"### 1.4.3.3 \u8f74\n",
"\n",
"\u8f74\u4e0e\u5b50\u56fe\u975e\u5e38\u7c7b\u4f3c\uff0c\u4e0d\u8fc7\u5141\u8bb8\u56fe\u5f62\u653e\u5728\u56fe\u7247\u7684\u4efb\u610f\u4f4d\u7f6e\u3002\u56e0\u6b64\uff0c\u5982\u679c\u6211\u4eec\u60f3\u8981\u5c06\u4e00\u4e2a\u5c0f\u56fe\u5f62\u653e\u5728\u4e00\u4e2a\u66f4\u5927\u56fe\u5f62\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u7528\u8f74\u3002\n",
"\n",
"<a class=\"reference external image-reference\" href=\"http://scipy-lectures.github.io/intro/auto_examples/plot_axes.html\"><img alt=\"plot_axes_1.png\" src=\"http://scipy-lectures.github.io/_images/plot_axes_1.png\" style=\"width: 280.0px; height: 210.0px;\"></a><a class=\"reference external image-reference\" href=\"http://scipy-lectures.github.io/intro/auto_examples/plot_axes-2.html\"><img alt=\"plot_axes-2_1.png\" src=\"http://scipy-lectures.github.io/_images/plot_axes-2_1.png\" style=\"width: 280.0px; height: 210.0px;\"></a>\n",
"\n",
"### 1.4.3.4 \u523b\u5ea6\n",
"\n",
"\u683c\u5f0f\u826f\u597d\u7684\u523b\u5ea6\u662f\u51c6\u5907\u597d\u53d1\u5e03\u56fe\u7247\u7684\u5fc5\u8981\u90e8\u5206\u3002Matplotlib\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5b8c\u5168\u53ef\u63a7\u7684\u523b\u5ea6\u7cfb\u7edf\u3002\u6709\u523b\u5ea6\u4f4d\u7f6e\u6765\u6307\u5b9a\u523b\u5ea6\u8be5\u51fa\u73b0\u5728\u54ea\uff0c\u8fd8\u6709\u523b\u5ea6\u683c\u5f0f\u6765\u7ed9\u51fa\u4f60\u60f3\u8981\u7684\u523b\u5ea6\u5916\u89c2\u3002\u4e3b\u523b\u5ea6\u548c\u81ea\u523b\u5ea6\u53ef\u4ee5\u88ab\u72ec\u7acb\u653e\u7f6e\u548c\u6574\u7406\u4e2a\u4e8b\u3002 Major and minor ticks can be located and formatted independently from each other. Per default minor ticks are not shown, i.e. there is only an empty list for them because it is as NullLocator (see below)."
]
},
{
Expand Down

0 comments on commit 24409e8

Please sign in to comment.