Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 20 additions & 43 deletions AnatomyOfMatplotlib-Part1-Figures_Subplots_and_layouts.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
"slide_type": "-"
}
},
"outputs": [],
"prompt_number": 1
"outputs": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -97,17 +96,7 @@
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"1.4.3\n",
"Qt4Agg\n"
]
}
],
"prompt_number": 2
"outputs": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -138,8 +127,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
"outputs": []
},
{
"cell_type": "markdown",
Expand All @@ -155,11 +143,11 @@
"\n",
"<img src=\"images/figure_axes_axis_labeled.png\">\n",
"\n",
"The ``Figure`` is the top-level container in this hirearchy. It's the overall window/page that everything is drawn on. You can have multiple independent figures, but they can't contain another figure. However, ``Figure``s can contain multiple ``Axes``. \n",
"The ``Figure`` is the top-level container in this hierarchy. It is the overall window/page that everything is drawn on. You can have multiple independent figures. However, ``Figure``s can contain multiple ``Axes``. \n",
"\n",
"Most plotting ocurs on an ``Axes``. The axes is effectively the area that we plot data on and any ticks/labels/etc associated with it. Usually we'll set up an axes with a call to ``subplot`` (which places axes on a regular grid), so in most cases we'll deal with here, ``Axes`` and ``Subplot`` are synonymous. We'll be heavily using ``Axes`` instances for plotting, etc, so you'll be seeing a lot of thse.\n",
"Most plotting ocurs on an ``Axes``. The axes is effectively the area that we plot data on and any ticks/labels/etc associated with it. Usually we'll set up an Axes with a call to ``subplot`` (which places Axes on a regular grid), so in most cases we'll deal with here, ``Axes`` and ``Subplot`` are synonymous. We'll be heavily using ``Axes`` instances for plotting, etc, so you'll be seeing a lot of these.\n",
"\n",
"Each ``Axes`` has an ``XAxis`` and a ``YAxis``. These contain the ticks, tick locations, labels, etc. In this tutorial, we'll mostly control ticks, tick labels, and data limits through other mechanisms, so we won't touch the individual ``Axis`` part of things much at all. However, it's worth mentioning here to explain where the term ``Axes`` comes from. Each ``Axes`` has two ``Axis`` instances.\n"
"Each ``Axes`` has an ``XAxis`` and a ``YAxis``. These contain the ticks, tick locations, labels, etc. In this tutorial, we'll mostly control ticks, tick labels, and data limits through other mechanisms, so we won't touch the individual ``Axis`` part of things much at all. However, it's worth mentioning here to explain where the term ``Axes`` comes from.\n"
]
},
{
Expand All @@ -180,8 +168,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand All @@ -200,8 +187,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand All @@ -220,8 +206,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand All @@ -244,8 +229,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand All @@ -271,15 +255,14 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"Notice the call to ``set``. Matplotlib's objects typically have lots of \"explicit setters\" -- in other words, functions that start with ``set_<something>`` and control a particular option. (This dates from a time before Python's ``property``.) \n",
"Notice the call to ``set``. Matplotlib's objects typically have lots of \"explicit setters\" -- in other words, functions that start with ``set_<something>`` and control a particular option. \n",
"\n",
"To demonstrate this (and as an example of IPython's tab-completion), try typing `ax.set_` in a code cell, then hit the `<Tab>` key. You'll see a long list of `Axes` methods that start with `set`.\n",
"\n",
Expand All @@ -298,8 +281,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -340,8 +322,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand All @@ -363,8 +344,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -399,8 +379,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -432,8 +411,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand All @@ -456,7 +434,7 @@
"\n",
"We'll be using that approach for the rest of the examples. It's much cleaner. \n",
"\n",
"However, keep in mind that we're still creating a figure and adding axes to it. We we start making plot layouts that can't be described by `subplots`, we'll go back to creating the figure first and then adding axes to it one-by-one."
"However, keep in mind that we're still creating a figure and adding axes to it. When we start making plot layouts that can't be described by `subplots`, we'll go back to creating the figure first and then adding axes to it one-by-one."
]
},
{
Expand Down Expand Up @@ -489,11 +467,10 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
}
],
"metadata": {}
}
]
}
}
55 changes: 19 additions & 36 deletions AnatomyOfMatplotlib-Part2-Limits_Legends_and_Layouts.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
"outputs": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -72,8 +71,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -102,8 +100,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -150,8 +147,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand All @@ -176,8 +172,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "code",
Expand All @@ -193,8 +188,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand All @@ -220,8 +214,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand All @@ -242,14 +235,13 @@
"input": [
"fig, ax = plt.subplots(1, 1)\n",
"ax.bar([1, 2, 3, 4], [10, 20, 25, 30], label=\"Foobar\", align='center', color='lightblue')\n",
"ax.plot([1, 2, 3, 4], [10, 20, 25, 30], color='darkred', label=\"_nolegend_\", marker='o')\n",
"ax.plot([1, 2, 3, 4], [10, 20, 25, 30], label=\"_nolegend_\", marker='o', color='darkred')\n",
"ax.legend(loc='best')\n",
"plt.show()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -282,8 +274,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 5
"outputs": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -321,8 +312,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -350,8 +340,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand All @@ -373,8 +362,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -410,8 +398,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -440,8 +427,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand All @@ -466,8 +452,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -507,8 +492,7 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -544,11 +528,10 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
"outputs": []
}
],
"metadata": {}
}
]
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Cheers!

[Part 0: Introduction To NumPy]: http://nbviewer.ipython.org/github/WeatherGod/AnatomyOfMatplotlib/blob/master/AnatomyOfMatplotlib-Part0-Intro2NumPy.ipynb
[Part 1: Overview of Matplotlib]: http://nbviewer.ipython.org/github/WeatherGod/AnatomyOfMatplotlib/blob/master/AnatomyOfMatplotlib-Part1-Figures_Subplots_and_layouts.ipynb
[Part 2: Limits, Legends and Layouts]: http://nbviewer.ipython.org/github/WeatherGod/AnatomyOfMatplotlib/blob/master/AnatomyOfMatplotlib-Part2-Limits_Legends_and_Layouts.ipynb
[Part 2: Limits, Legends, and Layouts]: http://nbviewer.ipython.org/github/WeatherGod/AnatomyOfMatplotlib/blob/master/AnatomyOfMatplotlib-Part2-Limits_Legends_and_Layouts.ipynb
[Part 3: How To Speak MPL]: http://nbviewer.ipython.org/github/WeatherGod/AnatomyOfMatplotlib/blob/master/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb
[Part 4: Artists]: http://nbviewer.ipython.org/github/WeatherGod/AnatomyOfMatplotlib/blob/master/AnatomyOfMatplotlib-Part4-Artists.ipynb
[Part 5: mpl_toolkits]: http://nbviewer.ipython.org/github/WeatherGod/AnatomyOfMatplotlib/blob/master/AnatomyOfMatplotlib-Part5-mpl_toolkits.ipynb