diff --git a/AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb b/AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb index 6ab58e8..ac00986 100644 --- a/AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb +++ b/AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb @@ -116,7 +116,7 @@ "# We could have also done this with two separate calls to `ax.bar` and numpy boolean indexing.\n", "for bar, height in zip(vert_bars, y):\n", " if height < 0:\n", - " bar.set(edgecolor='darkred', color='salmon', linewidth=3)\n", + " bar.set(color='salmon', edgecolor='darkred', linewidth=3)\n", "\n", "plt.show()" ] @@ -305,7 +305,7 @@ "outputs": [], "source": [ "from matplotlib.cbook import get_sample_data\n", - "data = np.load(get_sample_data('axes_grid/bivariate_normal.npy'))\n", + "data = np.load('assets/bivariate_normal.npy')\n", "\n", "fig, ax = plt.subplots()\n", "im = ax.imshow(data, cmap='gist_earth')\n", @@ -370,7 +370,7 @@ "outputs": [], "source": [ "from matplotlib.cbook import get_sample_data\n", - "data = np.load(get_sample_data('axes_grid/bivariate_normal.npy'))\n", + "data = np.load('assets/bivariate_normal.npy')\n", "\n", "fig, ax = plt.subplots()\n", "im = ax.imshow(data, cmap='seismic')\n", @@ -462,7 +462,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.5" + "version": "3.6.6" } }, "nbformat": 4, diff --git a/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb b/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb index d7bbf0e..e3c93fe 100644 --- a/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb +++ b/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb @@ -102,17 +102,17 @@ "# Markers\n", "[Markers](http://matplotlib.org/api/markers_api.html) are commonly used in [`plot()`](http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.plot) and [`scatter()`](http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.scatter) plots, but also show up elsewhere. There is a wide set of markers available, and custom markers can even be specified.\n", "\n", - "marker | description ||marker | description ||marker | description ||marker | description \n", - ":----------|:--------------||:---------|:--------------||:---------|:--------------||:---------|:--------------\n", - "\".\" | point ||\"+\" | plus ||\",\" | pixel ||\"x\" | cross\n", - "\"o\" | circle ||\"D\" | diamond ||\"d\" | thin_diamond || |\n", - "\"8\" | octagon ||\"s\" | square ||\"p\" | pentagon ||\"\\*\" | star\n", - "\"|\" | vertical line||\"\\_\" | horizontal line ||\"h\" | hexagon1 ||\"H\" | hexagon2\n", - "0 | tickleft ||4 | caretleft ||\"<\" | triangle_left ||\"3\" | tri_left\n", - "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` | default ||\" \" | nothing ||\"\" | nothing" + "marker | description | marker | description | marker | description | marker | description \n", + ":----------|:--------------|:----------|:----------------|:---------|:--------------|:----------|:--------------\n", + "\".\" | point | \"+\" | plus | \",\" | pixel | \"x\" | cross\n", + "\"o\" | circle | \"D\" | diamond | \"d\" | thin_diamond | |\n", + "\"8\" | octagon | \"s\" | square | \"p\" | pentagon | \"\\*\" | star\n", + "\"|\" | vertical line| \"\\_\" | horizontal line | \"h\" | hexagon1 | \"H\" | hexagon2\n", + "0 | tickleft | 4 | caretleft | \"<\" | triangle_left | \"3\" | tri_left\n", + "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` | default | \" \" | nothing | \"\" | nothing" ] }, { @@ -512,8 +512,8 @@ "source": [ "mpl.rc('axes', prop_cycle=cycler('color', ['r', 'orange', 'c', 'y']) +\n", " cycler('hatch', ['x', 'xx-', '+O.', '*']))\n", - "x = np.array([0.4, 0.2, 0.5, 0.8, 0.6])\n", - "y = [0, -5, -6, -5, 0]\n", + "x = np.array([0.7, 0.3, 0.385, 0.6153, 0.7, np.nan, 0.6, 0.4, 0.2, 0.5, 0.8, 0.6])\n", + "y = [0.65, 0.65, 0.1, 0.1, 0.65, np.nan, 0, 0, -5, -6, -5, 0]\n", "plt.fill(x+1, y)\n", "plt.fill(x+2, y)\n", "plt.fill(x+3, y)\n", @@ -607,9 +607,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.5" + "version": "3.7.3" } }, "nbformat": 4, - "nbformat_minor": 1 + "nbformat_minor": 2 } diff --git a/assets/bivariate_normal.npy b/assets/bivariate_normal.npy new file mode 100644 index 0000000..b6b8dac Binary files /dev/null and b/assets/bivariate_normal.npy differ diff --git a/solutions/2.2-vmin_vmax_imshow_and_colorbars.py b/solutions/2.2-vmin_vmax_imshow_and_colorbars.py index 2bc76a8..208e6ea 100644 --- a/solutions/2.2-vmin_vmax_imshow_and_colorbars.py +++ b/solutions/2.2-vmin_vmax_imshow_and_colorbars.py @@ -15,6 +15,7 @@ # Now you're on your own! for ax, data in zip(axes, [data1, data2, data3]): + # Display data, explicitly making the colormap cover values from 0 to 3 im = ax.imshow(data, vmin=0, vmax=3, interpolation='nearest') fig.colorbar(im, cax=cax, orientation='horizontal')
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: