diff --git a/AnatomyOfMatplotlib-Part1-Figures_Subplots_and_layouts.ipynb b/AnatomyOfMatplotlib-Part1-Figures_Subplots_and_layouts.ipynb index efa6b8a..bece646 100644 --- a/AnatomyOfMatplotlib-Part1-Figures_Subplots_and_layouts.ipynb +++ b/AnatomyOfMatplotlib-Part1-Figures_Subplots_and_layouts.ipynb @@ -58,7 +58,7 @@ "[Matplotlib](https://github.com/matplotlib) is hosted by GitHub.\n", "\n", "### Bug Reports and feature requests\n", - "So, you think you found a bug? Or maybe you think some feature is just too difficult to use? Or missing altogether? Submit your bug reports [here](https://github.com/matplotlib/matplotlib/issues) at Matplotlib's issue tracker. We even have a process for submitting and discussing Matplotlib Enhancement Proposals ([MEPs](http://matplotlib.org/devdocs/devel/MEP/index.html))." + "So, you think you found a bug? Or maybe you think some feature is just too difficult to use? Or missing altogether? Submit your bug reports [here](https://github.com/matplotlib/matplotlib/issues) at Matplotlib's issue tracker. We even have a process for submitting and discussing Matplotlib Enhancement Proposals ([MEPs](https://matplotlib.org/devel/MEP/index.html))." ] }, { @@ -200,7 +200,7 @@ "\n", "However, while we're on the topic, you can control the size of the figure through the ``figsize`` argument, which expects a tuple of ``(width, height)`` in inches. \n", "\n", - "A really useful utility function is [`figaspect`](http://matplotlib.org/api/figure_api.html?highlight=figaspect#matplotlib.figure.figaspect)" + "A really useful utility function is [`figaspect`](https://matplotlib.org/api/_as_gen/matplotlib.figure.figaspect.html?highlight=figaspect#matplotlib.figure.figaspect)" ] }, { diff --git a/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb b/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb index 5f7c0e7..d7bbf0e 100644 --- a/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb +++ b/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb @@ -43,7 +43,7 @@ "- k: black\n", "- w: white\n", "\n", - "Other colornames that are allowed are the HTML/CSS colornames such as \"burlywood\" and \"chartreuse\". See the [full list](http://www.w3schools.com/html/html_colornames.asp) of the 147 colornames. \n", + "Other colornames that are allowed are the HTML/CSS colornames such as \"burlywood\" and \"chartreuse\". See the [full list](https://www.w3schools.com/Colors/colors_names.asp) of the 140 color names. \n", "\n", "Matplotlib supports the [xkcd color names](https://xkcd.com/color/rgb/) prefxed by `'xkcd:'`.\n", "\n", @@ -112,7 +112,7 @@ "1 | tickright ||5 | caretright ||\">\" | triangle_right||\"4\" | tri_right\n", "2 | tickup ||6 | caretup ||\"^\" | triangle_up ||\"2\" | tri_up\n", "3 | tickdown ||7 | caretdown ||\"v\" | triangle_down ||\"1\" | tri_down\n", - "\"None\" | nothing ||`None` | nothing ||\" \" | nothing ||\"\" | nothing" + "\"None\" | nothing ||`None` | default ||\" \" | nothing ||\"\" | nothing" ] }, { @@ -128,7 +128,7 @@ " \"octagon\", \"square\", \"pentagon\", \"star\", \"vertical bar\", \"horizontal bar\", \"hexagon 1\", \"hexagon 2\",\n", " \"tick left\", \"caret left\", \"triangle left\", \"tri left\", \"tick right\", \"caret right\", \"triangle right\", \"tri right\",\n", " \"tick up\", \"caret up\", \"triangle up\", \"tri up\", \"tick down\", \"caret down\", \"triangle down\", \"tri down\",\n", - " \"Nothing\", \"Nothing\", \"Nothing\", \"Nothing\"]\n", + " \"Nothing\", \"default\", \"Nothing\", \"Nothing\"]\n", "fig, ax = plt.subplots(1, 1, figsize=(7.5, 4))\n", "for x, y, m, d in zip(xs.T.flat, ys.T.flat, markers, descripts):\n", " ax.scatter(x, y, marker=m, s=100)\n", diff --git a/AnatomyOfMatplotlib-Part4-Limits_Legends_and_Layouts.ipynb b/AnatomyOfMatplotlib-Part4-Limits_Legends_and_Layouts.ipynb index 534fc87..ec20839 100644 --- a/AnatomyOfMatplotlib-Part4-Limits_Legends_and_Layouts.ipynb +++ b/AnatomyOfMatplotlib-Part4-Limits_Legends_and_Layouts.ipynb @@ -288,7 +288,7 @@ "* A Tick Label is the text that is displayed at that tick.\n", "* A [`Ticker`](http://matplotlib.org/api/ticker_api.html#module-matplotlib.ticker) automatically determines the ticks for an Axis and formats the tick labels.\n", "\n", - "[`tick_params()`](http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.tick_params) is often used to help configure your tickers." + "[`tick_params()`](https://matplotlib.org/api/axes_api.html#ticks-and-tick-labels) is often used to help configure your tickers." ] }, { @@ -315,9 +315,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "A commonly-asked question is \"How do I plot non-numerical categories?\"\n", - " \n", - "Currently, the easiest way to do this is to \"fake\" the x-values and then change the tick labels to reflect the category.\n", + "A commonly-asked question is \"How do I plot categories?\"\n", + "\n", + "Starting in version 2.0 of mpl, just like any other data.\n", "\n", "For example:" ] @@ -334,9 +334,7 @@ "fruit, value = zip(*data)\n", "\n", "fig, ax = plt.subplots()\n", - "x = np.arange(len(fruit))\n", - "ax.bar(x, value, align='center', color='gray')\n", - "ax.set(xticks=x, xticklabels=fruit)\n", + "ax.bar(fruit, value, align='center', color='gray')\n", "plt.show()" ] }, diff --git a/AnatomyOfMatplotlib-Part5-Artists.ipynb b/AnatomyOfMatplotlib-Part5-Artists.ipynb index c52cd26..4da8545 100644 --- a/AnatomyOfMatplotlib-Part5-Artists.ipynb +++ b/AnatomyOfMatplotlib-Part5-Artists.ipynb @@ -161,7 +161,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To see what properties are set for an artist, use [`getp()`](http://matplotlib.org/api/artist_api.html#matplotlib.artist.getp)" + "To see what properties are set for an artist, use [`getp()`](https://matplotlib.org/api/artist_api.html#functions)" ] }, { @@ -182,7 +182,7 @@ "metadata": {}, "source": [ "# Collections\n", - "In addition to the Figure and Axes containers, there is another special type of container called a [`Collection`](http://matplotlib.org/api/collections_api.html). A Collection usually contains a list of primitives of the same kind that should all be treated similiarly. For example, a [`CircleCollection`](http://matplotlib.org/api/collections_api.html#matplotlib.collections.CircleCollection) would have a list of [`Circle`](http://matplotlib.org/api/artist_api.html#matplotlib.patches.Circle) objects all with the same color, size, and edge width. Individual property values for artists in the collection can also be set (in some cases)." + "In addition to the Figure and Axes containers, there is another special type of container called a [`Collection`](http://matplotlib.org/api/collections_api.html). A Collection usually contains a list of primitives of the same kind that should all be treated similiarly. For example, a [`CircleCollection`](http://matplotlib.org/api/collections_api.html#matplotlib.collections.CircleCollection) would have a list of [`Circle`](https://matplotlib.org/api/_as_gen/matplotlib.patches.Circle.html) objects all with the same color, size, and edge width. Individual property values for artists in the collection can also be set (in some cases)." ] }, { diff --git a/solutions/5.1-goldstar.py b/solutions/5.1-goldstar.py index 21f3272..7a04d3e 100644 --- a/solutions/5.1-goldstar.py +++ b/solutions/5.1-goldstar.py @@ -3,7 +3,7 @@ fig, ax = plt.subplots(1, 1) -offsets = zip([0.2, 0.4, 0.6, 0.8], [0.5] * 4) +offsets = list(zip([0.2, 0.4, 0.6, 0.8], [0.5] * 4)) collection = StarPolygonCollection(5, offsets=offsets, transOffset=ax.transData,