-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs build of c0cd944cc456a061ce1deb8d46aa4514b72092af
- Loading branch information
MatplotlibCircleBot
authored and
MatplotlibCircleBot
committed
Jul 16, 2017
1 parent
031e31b
commit c1b66f3
Showing
7,246 changed files
with
1,018,747 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: fee21aba0ad35d7353946075a94d4ae9 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"metadata": { | ||
"language_info": { | ||
"codemirror_mode": { | ||
"version": 3, | ||
"name": "ipython" | ||
}, | ||
"name": "python", | ||
"pygments_lexer": "ipython3", | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"nbconvert_exporter": "python", | ||
"version": "3.5.2" | ||
}, | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"name": "python3", | ||
"language": "python" | ||
} | ||
}, | ||
"cells": [ | ||
{ | ||
"source": [ | ||
"%matplotlib inline" | ||
], | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"cell_type": "code", | ||
"execution_count": null | ||
}, | ||
{ | ||
"source": [ | ||
"\n# Plot 2D data on 3D plot\n\n\nDemonstrates using ax.plot's zdir keyword to plot 2D data on\nselective axes of a 3D plot.\n\n" | ||
], | ||
"metadata": {}, | ||
"cell_type": "markdown" | ||
}, | ||
{ | ||
"source": [ | ||
"from mpl_toolkits.mplot3d import Axes3D\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfig = plt.figure()\nax = fig.gca(projection='3d')\n\n# Plot a sin curve using the x and y axes.\nx = np.linspace(0, 1, 100)\ny = np.sin(x * 2 * np.pi) / 2 + 0.5\nax.plot(x, y, zs=0, zdir='z', label='curve in (x,y)')\n\n# Plot scatterplot data (20 2D points per colour) on the x and z axes.\ncolors = ('r', 'g', 'b', 'k')\n\n# Fixing random state for reproducibility\nnp.random.seed(19680801)\n\nx = np.random.sample(20 * len(colors))\ny = np.random.sample(20 * len(colors))\nc_list = []\nfor c in colors:\n c_list.extend([c] * 20)\n# By using zdir='y', the y value of these points is fixed to the zs value 0\n# and the (x,y) points are plotted on the x and z axes.\nax.scatter(x, y, zs=0, zdir='y', c=c_list, label='points in (x,z)')\n\n# Make legend, set axes limits and labels\nax.legend()\nax.set_xlim(0, 1)\nax.set_ylim(0, 1)\nax.set_zlim(0, 1)\nax.set_xlabel('X')\nax.set_ylabel('Y')\nax.set_zlabel('Z')\n\n# Customize the view angle so it's easier to see that the scatter points lie\n# on the plane y=0\nax.view_init(elev=20., azim=-35)\n\nplt.show()" | ||
], | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"cell_type": "code", | ||
"execution_count": null | ||
} | ||
], | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
""" | ||
======================= | ||
Plot 2D data on 3D plot | ||
======================= | ||
Demonstrates using ax.plot's zdir keyword to plot 2D data on | ||
selective axes of a 3D plot. | ||
""" | ||
|
||
from mpl_toolkits.mplot3d import Axes3D | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
fig = plt.figure() | ||
ax = fig.gca(projection='3d') | ||
|
||
# Plot a sin curve using the x and y axes. | ||
x = np.linspace(0, 1, 100) | ||
y = np.sin(x * 2 * np.pi) / 2 + 0.5 | ||
ax.plot(x, y, zs=0, zdir='z', label='curve in (x,y)') | ||
|
||
# Plot scatterplot data (20 2D points per colour) on the x and z axes. | ||
colors = ('r', 'g', 'b', 'k') | ||
|
||
# Fixing random state for reproducibility | ||
np.random.seed(19680801) | ||
|
||
x = np.random.sample(20 * len(colors)) | ||
y = np.random.sample(20 * len(colors)) | ||
c_list = [] | ||
for c in colors: | ||
c_list.extend([c] * 20) | ||
# By using zdir='y', the y value of these points is fixed to the zs value 0 | ||
# and the (x,y) points are plotted on the x and z axes. | ||
ax.scatter(x, y, zs=0, zdir='y', c=c_list, label='points in (x,z)') | ||
|
||
# Make legend, set axes limits and labels | ||
ax.legend() | ||
ax.set_xlim(0, 1) | ||
ax.set_ylim(0, 1) | ||
ax.set_zlim(0, 1) | ||
ax.set_xlabel('X') | ||
ax.set_ylabel('Y') | ||
ax.set_zlabel('Z') | ||
|
||
# Customize the view angle so it's easier to see that the scatter points lie | ||
# on the plane y=0 | ||
ax.view_init(elev=20., azim=-35) | ||
|
||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"metadata": { | ||
"language_info": { | ||
"codemirror_mode": { | ||
"version": 3, | ||
"name": "ipython" | ||
}, | ||
"name": "python", | ||
"pygments_lexer": "ipython3", | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"nbconvert_exporter": "python", | ||
"version": "3.5.2" | ||
}, | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"name": "python3", | ||
"language": "python" | ||
} | ||
}, | ||
"cells": [ | ||
{ | ||
"source": [ | ||
"%matplotlib inline" | ||
], | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"cell_type": "code", | ||
"execution_count": null | ||
}, | ||
{ | ||
"source": [ | ||
"\n# Frontpage 3D example\n\n\nThis example reproduces the frontpage 3D example.\n\n\n" | ||
], | ||
"metadata": {}, | ||
"cell_type": "markdown" | ||
}, | ||
{ | ||
"source": [ | ||
"from mpl_toolkits.mplot3d import Axes3D\nfrom matplotlib import cbook\nfrom matplotlib import cm\nfrom matplotlib.colors import LightSource\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfilename = cbook.get_sample_data('jacksboro_fault_dem.npz', asfileobj=False)\nwith np.load(filename) as dem:\n z = dem['elevation']\n nrows, ncols = z.shape\n x = np.linspace(dem['xmin'], dem['xmax'], ncols)\n y = np.linspace(dem['ymin'], dem['ymax'], nrows)\n x, y = np.meshgrid(x, y)\n\nregion = np.s_[5:50, 5:50]\nx, y, z = x[region], y[region], z[region]\n\nfig, ax = plt.subplots(subplot_kw=dict(projection='3d'))\n\nls = LightSource(270, 45)\n# To use a custom hillshading mode, override the built-in shading and pass\n# in the rgb colors of the shaded surface calculated from \"shade\".\nrgb = ls.shade(z, cmap=cm.gist_earth, vert_exag=0.1, blend_mode='soft')\nsurf = ax.plot_surface(x, y, z, rstride=1, cstride=1, facecolors=rgb,\n linewidth=0, antialiased=False, shade=False)\nax.set_xticks([])\nax.set_yticks([])\nax.set_zticks([])\nfig.savefig(\"surface3d_frontpage.png\", dpi=25) # results in 160x120 px image" | ||
], | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"cell_type": "code", | ||
"execution_count": null | ||
} | ||
], | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
""" | ||
==================== | ||
Frontpage 3D example | ||
==================== | ||
This example reproduces the frontpage 3D example. | ||
""" | ||
from mpl_toolkits.mplot3d import Axes3D | ||
from matplotlib import cbook | ||
from matplotlib import cm | ||
from matplotlib.colors import LightSource | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
filename = cbook.get_sample_data('jacksboro_fault_dem.npz', asfileobj=False) | ||
with np.load(filename) as dem: | ||
z = dem['elevation'] | ||
nrows, ncols = z.shape | ||
x = np.linspace(dem['xmin'], dem['xmax'], ncols) | ||
y = np.linspace(dem['ymin'], dem['ymax'], nrows) | ||
x, y = np.meshgrid(x, y) | ||
|
||
region = np.s_[5:50, 5:50] | ||
x, y, z = x[region], y[region], z[region] | ||
|
||
fig, ax = plt.subplots(subplot_kw=dict(projection='3d')) | ||
|
||
ls = LightSource(270, 45) | ||
# To use a custom hillshading mode, override the built-in shading and pass | ||
# in the rgb colors of the shaded surface calculated from "shade". | ||
rgb = ls.shade(z, cmap=cm.gist_earth, vert_exag=0.1, blend_mode='soft') | ||
surf = ax.plot_surface(x, y, z, rstride=1, cstride=1, facecolors=rgb, | ||
linewidth=0, antialiased=False, shade=False) | ||
ax.set_xticks([]) | ||
ax.set_yticks([]) | ||
ax.set_zticks([]) | ||
fig.savefig("surface3d_frontpage.png", dpi=25) # results in 160x120 px image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"source": [ | ||
"%matplotlib inline" | ||
], | ||
"outputs": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n# Demo of 3D bar charts\n\n\nA basic demo of how to plot 3D bars with and without\nshading.\n\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"source": [ | ||
"import numpy as np\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits.mplot3d import Axes3D\n\n\n# setup the figure and axes\nfig = plt.figure(figsize=(8, 3))\nax1 = fig.add_subplot(121, projection='3d')\nax2 = fig.add_subplot(122, projection='3d')\n\n# fake data\n_x = np.arange(4)\n_y = np.arange(5)\n_xx, _yy = np.meshgrid(_x, _y)\nx, y = _xx.ravel(), _yy.ravel()\n\ntop = x + y\nbottom = np.zeros_like(top)\nwidth = depth = 1\n\nax1.bar3d(x, y, bottom, width, depth, top, shade=True)\nax1.set_title('Shaded')\n\nax2.bar3d(x, y, bottom, width, depth, top, shade=False)\nax2.set_title('Not Shaded')\n\nplt.show()" | ||
], | ||
"outputs": [] | ||
} | ||
], | ||
"nbformat_minor": 0, | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"version": "3.5.2", | ||
"nbconvert_exporter": "python", | ||
"mimetype": "text/x-python", | ||
"codemirror_mode": { | ||
"version": 3, | ||
"name": "ipython" | ||
}, | ||
"file_extension": ".py", | ||
"pygments_lexer": "ipython3", | ||
"name": "python" | ||
} | ||
}, | ||
"nbformat": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
""" | ||
===================== | ||
Demo of 3D bar charts | ||
===================== | ||
A basic demo of how to plot 3D bars with and without | ||
shading. | ||
""" | ||
|
||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
from mpl_toolkits.mplot3d import Axes3D | ||
|
||
|
||
# setup the figure and axes | ||
fig = plt.figure(figsize=(8, 3)) | ||
ax1 = fig.add_subplot(121, projection='3d') | ||
ax2 = fig.add_subplot(122, projection='3d') | ||
|
||
# fake data | ||
_x = np.arange(4) | ||
_y = np.arange(5) | ||
_xx, _yy = np.meshgrid(_x, _y) | ||
x, y = _xx.ravel(), _yy.ravel() | ||
|
||
top = x + y | ||
bottom = np.zeros_like(top) | ||
width = depth = 1 | ||
|
||
ax1.bar3d(x, y, bottom, width, depth, top, shade=True) | ||
ax1.set_title('Shaded') | ||
|
||
ax2.bar3d(x, y, bottom, width, depth, top, shade=False) | ||
ax2.set_title('Not Shaded') | ||
|
||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"source": [ | ||
"%matplotlib inline" | ||
], | ||
"outputs": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n# Using accented text in matplotlib\n\n\nMatplotlib supports accented characters via TeX mathtext or unicode.\n\nUsing mathtext, the following accents are provided: \\hat, \\breve, \\grave, \\bar,\n\\acute, \\tilde, \\vec, \\dot, \\ddot. All of them have the same syntax,\ne.g., to make an overbar you do \\bar{o} or to make an o umlaut you do\n\\ddot{o}. The shortcuts are also provided, e.g.,: \\\"o \\'e \\`e \\~n \\.x\n\\^y\n\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"source": [ | ||
"from __future__ import unicode_literals\nimport matplotlib.pyplot as plt\n\n# Mathtext demo\nfig, ax = plt.subplots()\nax.plot(range(10))\nax.set_title(r'$\\ddot{o}\\acute{e}\\grave{e}\\hat{O}'\n r'\\breve{i}\\bar{A}\\tilde{n}\\vec{q}$', fontsize=20)\n\n# Shorthand is also supported and curly braces are optional\nax.set_xlabel(r\"\"\"$\\\"o\\ddot o \\'e\\`e\\~n\\.x\\^y$\"\"\", fontsize=20)\nax.text(4, 0.5, r\"$F=m\\ddot{x}$\")\nfig.tight_layout()\n\n# Unicode demo\nfig, ax = plt.subplots()\nax.set_title(\"GISCARD CHAHUT\u00c9 \u00c0 L'ASSEMBL\u00c9E\")\nax.set_xlabel(\"LE COUP DE D\u00c9 DE DE GAULLE\")\nax.set_ylabel('Andr\u00e9 was here!')\nax.text(0.2, 0.8, 'Institut f\u00fcr Festk\u00f6rperphysik', rotation=45)\nax.text(0.4, 0.2, 'AVA (check kerning)')\n\nplt.show()" | ||
], | ||
"outputs": [] | ||
} | ||
], | ||
"nbformat_minor": 0, | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"version": "3.5.2", | ||
"nbconvert_exporter": "python", | ||
"mimetype": "text/x-python", | ||
"codemirror_mode": { | ||
"version": 3, | ||
"name": "ipython" | ||
}, | ||
"file_extension": ".py", | ||
"pygments_lexer": "ipython3", | ||
"name": "python" | ||
} | ||
}, | ||
"nbformat": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# -*- coding: utf-8 -*- | ||
r""" | ||
================================= | ||
Using accented text in matplotlib | ||
================================= | ||
Matplotlib supports accented characters via TeX mathtext or unicode. | ||
Using mathtext, the following accents are provided: \hat, \breve, \grave, \bar, | ||
\acute, \tilde, \vec, \dot, \ddot. All of them have the same syntax, | ||
e.g., to make an overbar you do \bar{o} or to make an o umlaut you do | ||
\ddot{o}. The shortcuts are also provided, e.g.,: \"o \'e \`e \~n \.x | ||
\^y | ||
""" | ||
from __future__ import unicode_literals | ||
import matplotlib.pyplot as plt | ||
|
||
# Mathtext demo | ||
fig, ax = plt.subplots() | ||
ax.plot(range(10)) | ||
ax.set_title(r'$\ddot{o}\acute{e}\grave{e}\hat{O}' | ||
r'\breve{i}\bar{A}\tilde{n}\vec{q}$', fontsize=20) | ||
|
||
# Shorthand is also supported and curly braces are optional | ||
ax.set_xlabel(r"""$\"o\ddot o \'e\`e\~n\.x\^y$""", fontsize=20) | ||
ax.text(4, 0.5, r"$F=m\ddot{x}$") | ||
fig.tight_layout() | ||
|
||
# Unicode demo | ||
fig, ax = plt.subplots() | ||
ax.set_title("GISCARD CHAHUTÉ À L'ASSEMBLÉE") | ||
ax.set_xlabel("LE COUP DE DÉ DE DE GAULLE") | ||
ax.set_ylabel('André was here!') | ||
ax.text(0.2, 0.8, 'Institut für Festkörperphysik', rotation=45) | ||
ax.text(0.4, 0.2, 'AVA (check kerning)') | ||
|
||
plt.show() |
Oops, something went wrong.