Skip to content

Commit c1b66f3

Browse files
MatplotlibCircleBotMatplotlibCircleBot
MatplotlibCircleBot
authored and
MatplotlibCircleBot
committed
Docs build of c0cd944cc456a061ce1deb8d46aa4514b72092af
1 parent 031e31b commit c1b66f3

File tree

7,246 files changed

+1018747
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

7,246 files changed

+1018747
-0
lines changed

.buildinfo

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Sphinx build info version 1
2+
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3+
config: fee21aba0ad35d7353946075a94d4ae9
4+
tags: 645f666f9bcd5a90fca523b33c5a78b7

.nojekyll

Whitespace-only changes.

_downloads/2dcollections3d.ipynb

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"metadata": {
3+
"language_info": {
4+
"codemirror_mode": {
5+
"version": 3,
6+
"name": "ipython"
7+
},
8+
"name": "python",
9+
"pygments_lexer": "ipython3",
10+
"file_extension": ".py",
11+
"mimetype": "text/x-python",
12+
"nbconvert_exporter": "python",
13+
"version": "3.5.2"
14+
},
15+
"kernelspec": {
16+
"display_name": "Python 3",
17+
"name": "python3",
18+
"language": "python"
19+
}
20+
},
21+
"cells": [
22+
{
23+
"source": [
24+
"%matplotlib inline"
25+
],
26+
"metadata": {
27+
"collapsed": false
28+
},
29+
"outputs": [],
30+
"cell_type": "code",
31+
"execution_count": null
32+
},
33+
{
34+
"source": [
35+
"\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"
36+
],
37+
"metadata": {},
38+
"cell_type": "markdown"
39+
},
40+
{
41+
"source": [
42+
"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()"
43+
],
44+
"metadata": {
45+
"collapsed": false
46+
},
47+
"outputs": [],
48+
"cell_type": "code",
49+
"execution_count": null
50+
}
51+
],
52+
"nbformat": 4,
53+
"nbformat_minor": 0
54+
}

_downloads/2dcollections3d.py

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
"""
2+
=======================
3+
Plot 2D data on 3D plot
4+
=======================
5+
6+
Demonstrates using ax.plot's zdir keyword to plot 2D data on
7+
selective axes of a 3D plot.
8+
"""
9+
10+
from mpl_toolkits.mplot3d import Axes3D
11+
import numpy as np
12+
import matplotlib.pyplot as plt
13+
14+
fig = plt.figure()
15+
ax = fig.gca(projection='3d')
16+
17+
# Plot a sin curve using the x and y axes.
18+
x = np.linspace(0, 1, 100)
19+
y = np.sin(x * 2 * np.pi) / 2 + 0.5
20+
ax.plot(x, y, zs=0, zdir='z', label='curve in (x,y)')
21+
22+
# Plot scatterplot data (20 2D points per colour) on the x and z axes.
23+
colors = ('r', 'g', 'b', 'k')
24+
25+
# Fixing random state for reproducibility
26+
np.random.seed(19680801)
27+
28+
x = np.random.sample(20 * len(colors))
29+
y = np.random.sample(20 * len(colors))
30+
c_list = []
31+
for c in colors:
32+
c_list.extend([c] * 20)
33+
# By using zdir='y', the y value of these points is fixed to the zs value 0
34+
# and the (x,y) points are plotted on the x and z axes.
35+
ax.scatter(x, y, zs=0, zdir='y', c=c_list, label='points in (x,z)')
36+
37+
# Make legend, set axes limits and labels
38+
ax.legend()
39+
ax.set_xlim(0, 1)
40+
ax.set_ylim(0, 1)
41+
ax.set_zlim(0, 1)
42+
ax.set_xlabel('X')
43+
ax.set_ylabel('Y')
44+
ax.set_zlabel('Z')
45+
46+
# Customize the view angle so it's easier to see that the scatter points lie
47+
# on the plane y=0
48+
ax.view_init(elev=20., azim=-35)
49+
50+
plt.show()

_downloads/3D.ipynb

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"metadata": {
3+
"language_info": {
4+
"codemirror_mode": {
5+
"version": 3,
6+
"name": "ipython"
7+
},
8+
"name": "python",
9+
"pygments_lexer": "ipython3",
10+
"file_extension": ".py",
11+
"mimetype": "text/x-python",
12+
"nbconvert_exporter": "python",
13+
"version": "3.5.2"
14+
},
15+
"kernelspec": {
16+
"display_name": "Python 3",
17+
"name": "python3",
18+
"language": "python"
19+
}
20+
},
21+
"cells": [
22+
{
23+
"source": [
24+
"%matplotlib inline"
25+
],
26+
"metadata": {
27+
"collapsed": false
28+
},
29+
"outputs": [],
30+
"cell_type": "code",
31+
"execution_count": null
32+
},
33+
{
34+
"source": [
35+
"\n# Frontpage 3D example\n\n\nThis example reproduces the frontpage 3D example.\n\n\n"
36+
],
37+
"metadata": {},
38+
"cell_type": "markdown"
39+
},
40+
{
41+
"source": [
42+
"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"
43+
],
44+
"metadata": {
45+
"collapsed": false
46+
},
47+
"outputs": [],
48+
"cell_type": "code",
49+
"execution_count": null
50+
}
51+
],
52+
"nbformat": 4,
53+
"nbformat_minor": 0
54+
}

_downloads/3D.py

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
"""
2+
====================
3+
Frontpage 3D example
4+
====================
5+
6+
This example reproduces the frontpage 3D example.
7+
8+
"""
9+
from mpl_toolkits.mplot3d import Axes3D
10+
from matplotlib import cbook
11+
from matplotlib import cm
12+
from matplotlib.colors import LightSource
13+
import matplotlib.pyplot as plt
14+
import numpy as np
15+
16+
filename = cbook.get_sample_data('jacksboro_fault_dem.npz', asfileobj=False)
17+
with np.load(filename) as dem:
18+
z = dem['elevation']
19+
nrows, ncols = z.shape
20+
x = np.linspace(dem['xmin'], dem['xmax'], ncols)
21+
y = np.linspace(dem['ymin'], dem['ymax'], nrows)
22+
x, y = np.meshgrid(x, y)
23+
24+
region = np.s_[5:50, 5:50]
25+
x, y, z = x[region], y[region], z[region]
26+
27+
fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
28+
29+
ls = LightSource(270, 45)
30+
# To use a custom hillshading mode, override the built-in shading and pass
31+
# in the rgb colors of the shaded surface calculated from "shade".
32+
rgb = ls.shade(z, cmap=cm.gist_earth, vert_exag=0.1, blend_mode='soft')
33+
surf = ax.plot_surface(x, y, z, rstride=1, cstride=1, facecolors=rgb,
34+
linewidth=0, antialiased=False, shade=False)
35+
ax.set_xticks([])
36+
ax.set_yticks([])
37+
ax.set_zticks([])
38+
fig.savefig("surface3d_frontpage.png", dpi=25) # results in 160x120 px image

_downloads/3d_bars.ipynb

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {
7+
"collapsed": false
8+
},
9+
"source": [
10+
"%matplotlib inline"
11+
],
12+
"outputs": []
13+
},
14+
{
15+
"cell_type": "markdown",
16+
"metadata": {},
17+
"source": [
18+
"\n# Demo of 3D bar charts\n\n\nA basic demo of how to plot 3D bars with and without\nshading.\n\n\n"
19+
]
20+
},
21+
{
22+
"cell_type": "code",
23+
"execution_count": null,
24+
"metadata": {
25+
"collapsed": false
26+
},
27+
"source": [
28+
"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()"
29+
],
30+
"outputs": []
31+
}
32+
],
33+
"nbformat_minor": 0,
34+
"metadata": {
35+
"kernelspec": {
36+
"display_name": "Python 3",
37+
"language": "python",
38+
"name": "python3"
39+
},
40+
"language_info": {
41+
"version": "3.5.2",
42+
"nbconvert_exporter": "python",
43+
"mimetype": "text/x-python",
44+
"codemirror_mode": {
45+
"version": 3,
46+
"name": "ipython"
47+
},
48+
"file_extension": ".py",
49+
"pygments_lexer": "ipython3",
50+
"name": "python"
51+
}
52+
},
53+
"nbformat": 4
54+
}

_downloads/3d_bars.py

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""
2+
=====================
3+
Demo of 3D bar charts
4+
=====================
5+
6+
A basic demo of how to plot 3D bars with and without
7+
shading.
8+
9+
"""
10+
11+
import numpy as np
12+
import matplotlib.pyplot as plt
13+
from mpl_toolkits.mplot3d import Axes3D
14+
15+
16+
# setup the figure and axes
17+
fig = plt.figure(figsize=(8, 3))
18+
ax1 = fig.add_subplot(121, projection='3d')
19+
ax2 = fig.add_subplot(122, projection='3d')
20+
21+
# fake data
22+
_x = np.arange(4)
23+
_y = np.arange(5)
24+
_xx, _yy = np.meshgrid(_x, _y)
25+
x, y = _xx.ravel(), _yy.ravel()
26+
27+
top = x + y
28+
bottom = np.zeros_like(top)
29+
width = depth = 1
30+
31+
ax1.bar3d(x, y, bottom, width, depth, top, shade=True)
32+
ax1.set_title('Shaded')
33+
34+
ax2.bar3d(x, y, bottom, width, depth, top, shade=False)
35+
ax2.set_title('Not Shaded')
36+
37+
plt.show()

_downloads/accented_text.ipynb

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {
7+
"collapsed": false
8+
},
9+
"source": [
10+
"%matplotlib inline"
11+
],
12+
"outputs": []
13+
},
14+
{
15+
"cell_type": "markdown",
16+
"metadata": {},
17+
"source": [
18+
"\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"
19+
]
20+
},
21+
{
22+
"cell_type": "code",
23+
"execution_count": null,
24+
"metadata": {
25+
"collapsed": false
26+
},
27+
"source": [
28+
"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()"
29+
],
30+
"outputs": []
31+
}
32+
],
33+
"nbformat_minor": 0,
34+
"metadata": {
35+
"kernelspec": {
36+
"display_name": "Python 3",
37+
"language": "python",
38+
"name": "python3"
39+
},
40+
"language_info": {
41+
"version": "3.5.2",
42+
"nbconvert_exporter": "python",
43+
"mimetype": "text/x-python",
44+
"codemirror_mode": {
45+
"version": 3,
46+
"name": "ipython"
47+
},
48+
"file_extension": ".py",
49+
"pygments_lexer": "ipython3",
50+
"name": "python"
51+
}
52+
},
53+
"nbformat": 4
54+
}

_downloads/accented_text.py

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# -*- coding: utf-8 -*-
2+
r"""
3+
=================================
4+
Using accented text in matplotlib
5+
=================================
6+
7+
Matplotlib supports accented characters via TeX mathtext or unicode.
8+
9+
Using mathtext, the following accents are provided: \hat, \breve, \grave, \bar,
10+
\acute, \tilde, \vec, \dot, \ddot. All of them have the same syntax,
11+
e.g., to make an overbar you do \bar{o} or to make an o umlaut you do
12+
\ddot{o}. The shortcuts are also provided, e.g.,: \"o \'e \`e \~n \.x
13+
\^y
14+
15+
"""
16+
from __future__ import unicode_literals
17+
import matplotlib.pyplot as plt
18+
19+
# Mathtext demo
20+
fig, ax = plt.subplots()
21+
ax.plot(range(10))
22+
ax.set_title(r'$\ddot{o}\acute{e}\grave{e}\hat{O}'
23+
r'\breve{i}\bar{A}\tilde{n}\vec{q}$', fontsize=20)
24+
25+
# Shorthand is also supported and curly braces are optional
26+
ax.set_xlabel(r"""$\"o\ddot o \'e\`e\~n\.x\^y$""", fontsize=20)
27+
ax.text(4, 0.5, r"$F=m\ddot{x}$")
28+
fig.tight_layout()
29+
30+
# Unicode demo
31+
fig, ax = plt.subplots()
32+
ax.set_title("GISCARD CHAHUTÉ À L'ASSEMBLÉE")
33+
ax.set_xlabel("LE COUP DE DÉ DE DE GAULLE")
34+
ax.set_ylabel('André was here!')
35+
ax.text(0.2, 0.8, 'Institut für Festkörperphysik', rotation=45)
36+
ax.text(0.4, 0.2, 'AVA (check kerning)')
37+
38+
plt.show()

0 commit comments

Comments
 (0)