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
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ mpl-run: &mpl-install
doc-run: &doc-build
name: Build documentation
command: |
# Set epoch to date of latest tag.
export SOURCE_DATE_EPOCH="$(git log -1 --format=%at $(git describe --abbrev=0))"
make html O=-T
rm -r build/html/_sources
working_directory: doc
Expand Down
4 changes: 4 additions & 0 deletions examples/axes_grid1/demo_anchored_direction_arrows.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredDirectionArrows
import matplotlib.font_manager as fm


# Fixing random state for reproducibility
np.random.seed(19680801)

fig, ax = plt.subplots()
ax.imshow(np.random.random((10, 10)))

Expand Down
4 changes: 4 additions & 0 deletions examples/event_handling/image_slices_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
import matplotlib.pyplot as plt


# Fixing random state for reproducibility
np.random.seed(19680801)


class IndexTracker:
def __init__(self, ax, X):
self.ax = ax
Expand Down
4 changes: 4 additions & 0 deletions examples/event_handling/pick_event_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ def pick_handler(event):
from numpy.random import rand


# Fixing random state for reproducibility
np.random.seed(19680801)


def pick_simple():
# simple picking, lines, rectangles and text
fig, (ax1, ax2) = plt.subplots(2, 1)
Expand Down
3 changes: 3 additions & 0 deletions examples/event_handling/pick_event_demo2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
import matplotlib.pyplot as plt


# Fixing random state for reproducibility
np.random.seed(19680801)

X = np.random.rand(100, 1000)
xs = np.mean(X, axis=1)
ys = np.std(X, axis=1)
Expand Down
4 changes: 4 additions & 0 deletions examples/event_handling/zoom_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
import matplotlib.pyplot as plt
import numpy as np


# Fixing random state for reproducibility
np.random.seed(19680801)

figsrc, axsrc = plt.subplots()
figzoom, axzoom = plt.subplots()
axsrc.set(xlim=(0, 1), ylim=(0, 1), autoscale_on=False,
Expand Down
4 changes: 4 additions & 0 deletions examples/images_contours_and_fields/image_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
from matplotlib.path import Path
from matplotlib.patches import PathPatch


# Fixing random state for reproducibility
np.random.seed(19680801)

###############################################################################
# First we'll generate a simple bivariate normal distribution.

Expand Down
4 changes: 4 additions & 0 deletions examples/images_contours_and_fields/pcolor_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
import numpy as np
from matplotlib.colors import LogNorm


# Fixing random state for reproducibility
np.random.seed(19680801)

###############################################################################
# A simple pcolor demo
# --------------------
Expand Down
4 changes: 4 additions & 0 deletions examples/images_contours_and_fields/spy_demos.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
import matplotlib.pyplot as plt
import numpy as np


# Fixing random state for reproducibility
np.random.seed(19680801)

fig, axs = plt.subplots(2, 2)
ax1 = axs[0, 0]
ax2 = axs[0, 1]
Expand Down
4 changes: 4 additions & 0 deletions examples/lines_bars_and_markers/scatter_custom_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
import matplotlib.pyplot as plt
import numpy as np


# Fixing random state for reproducibility
np.random.seed(19680801)

# unit area ellipse
rx, ry = 3., 1.
area = rx * ry * np.pi
Expand Down
4 changes: 4 additions & 0 deletions examples/lines_bars_and_markers/stackplot_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
import numpy as np
import matplotlib.pyplot as plt


# Fixing random state for reproducibility
np.random.seed(19680801)

x = [1, 2, 3, 4, 5]
y1 = [1, 1, 2, 3, 5]
y2 = [0, 4, 2, 6, 8]
Expand Down
3 changes: 3 additions & 0 deletions examples/lines_bars_and_markers/vline_hline_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import numpy as np


# Fixing random state for reproducibility
np.random.seed(19680801)

t = np.arange(0.0, 5.0, 0.1)
s = np.exp(-t) + np.sin(2 * np.pi * t) + 1
nse = np.random.normal(0.0, 0.3, t.shape) * s
Expand Down
4 changes: 4 additions & 0 deletions examples/recipes/create_subplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
import matplotlib.pyplot as plt
import numpy as np


# Fixing random state for reproducibility
np.random.seed(19680801)

x = np.random.randn(50)

# old style
Expand Down
4 changes: 4 additions & 0 deletions examples/recipes/fill_between_alpha.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
import numpy as np
import matplotlib.cbook as cbook


# Fixing random state for reproducibility
np.random.seed(19680801)

# load up some sample financial data
with cbook.get_sample_data('goog.npz') as datafile:
r = np.load(datafile)['price_data'].view(np.recarray)
Expand Down
6 changes: 5 additions & 1 deletion examples/scales/power_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@
import numpy as np
from numpy.random import multivariate_normal


# Fixing random state for reproducibility.
np.random.seed(19680801)

data = np.vstack([
multivariate_normal([10, 10], [[3, 2], [2, 3]], size=100000),
multivariate_normal([30, 20], [[2, 3], [1, 3]], size=1000)
multivariate_normal([30, 20], [[3, 1], [1, 3]], size=1000)
])

gammas = [0.8, 0.5, 0.3]
Expand Down
6 changes: 3 additions & 3 deletions examples/scales/scales.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,17 @@ def inverse(a):

ax = axs[2, 1]

t = np.arange(-170.0, 170.0, 0.1)
t = np.arange(0, 170.0, 0.1)
s = t / 2.

ax.plot(t, s, '-', lw=2)

ax.set_yscale('function', functions=(forward, inverse))
ax.set_title('function: Mercator')
ax.grid(True)
ax.set_xlim([-180, 180])
ax.set_xlim([0, 180])
ax.yaxis.set_minor_formatter(NullFormatter())
ax.yaxis.set_major_locator(FixedLocator(np.arange(-90, 90, 30)))
ax.yaxis.set_major_locator(FixedLocator(np.arange(0, 90, 10)))

plt.show()

Expand Down
4 changes: 4 additions & 0 deletions examples/shapes_and_collections/ellipse_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
import numpy as np
from matplotlib.patches import Ellipse


# Fixing random state for reproducibility
np.random.seed(19680801)

NUM = 250

ells = [Ellipse(xy=np.random.rand(2) * 10,
Expand Down
9 changes: 6 additions & 3 deletions examples/style_sheets/bmh.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@
.. [1] http://camdavidsonpilon.github.io/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/

"""
from numpy.random import beta
import numpy as np
import matplotlib.pyplot as plt


# Fixing random state for reproducibility
np.random.seed(19680801)

plt.style.use('bmh')


def plot_beta_hist(ax, a, b):
ax.hist(beta(a, b, size=10000), histtype="stepfilled",
bins=25, alpha=0.8, density=True)
ax.hist(np.random.beta(a, b, size=10000),
histtype="stepfilled", bins=25, alpha=0.8, density=True)


fig, ax = plt.subplots()
Expand Down
5 changes: 5 additions & 0 deletions examples/style_sheets/plot_solarizedlight2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
"""
import matplotlib.pyplot as plt
import numpy as np


# Fixing random state for reproducibility
np.random.seed(19680801)

x = np.linspace(0, 10)
with plt.style.context('Solarize_Light2'):
plt.plot(x, np.sin(x) + x + np.random.randn(50))
Expand Down
2 changes: 2 additions & 0 deletions examples/subplots_axes_and_figures/axes_box_aspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@

fig4, (ax, ax2) = plt.subplots(ncols=2, constrained_layout=True)

np.random.seed(19680801) # Fixing random state for reproducibility
im = np.random.rand(16, 27)
ax.imshow(im)

Expand All @@ -106,6 +107,7 @@
axs[1, 0].set_box_aspect(1)
axs[1, 1].set_box_aspect(3/1)

np.random.seed(19680801) # Fixing random state for reproducibility
x, y = np.random.randn(2, 400) * [[.5], [180]]
axs[1, 0].scatter(x, y)
axs[0, 0].hist(x)
Expand Down
4 changes: 4 additions & 0 deletions examples/subplots_axes_and_figures/colorbar_placement.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
import matplotlib.pyplot as plt
import numpy as np


# Fixing random state for reproducibility
np.random.seed(19680801)

fig, axs = plt.subplots(2, 2)
cm = ['RdBu_r', 'viridis']
for col in range(2):
Expand Down
4 changes: 4 additions & 0 deletions examples/subplots_axes_and_figures/subplot_toolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
import matplotlib.pyplot as plt
import numpy as np


# Fixing random state for reproducibility
np.random.seed(19680801)

fig, axs = plt.subplots(2, 2)

axs[0, 0].imshow(np.random.random((100, 100)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_rotation_mode(fig, mode, subplot_location):
# highlight bbox
fig.canvas.draw()
for ax, tx in zip(grid, texts):
bb = tx.get_window_extent().inverse_transformed(ax.transData)
bb = tx.get_window_extent().transformed(ax.transData.inverted())
rect = plt.Rectangle((bb.x0, bb.y0), bb.width, bb.height,
facecolor="C1", alpha=0.3, zorder=2)
ax.add_patch(rect)
Expand Down
4 changes: 4 additions & 0 deletions examples/ticks_and_spines/colorbar_tick_labelling_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
from matplotlib import cm
from numpy.random import randn


# Fixing random state for reproducibility
np.random.seed(19680801)

###############################################################################
# Make plot with vertical (default) colorbar

Expand Down
4 changes: 4 additions & 0 deletions examples/userdemo/annotate_text_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
import numpy as np
import matplotlib.pyplot as plt


# Fixing random state for reproducibility
np.random.seed(19680801)

fig, ax = plt.subplots(figsize=(5, 5))
ax.set_aspect(1)

Expand Down
2 changes: 0 additions & 2 deletions tutorials/colors/colormap-manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
from matplotlib.colors import ListedColormap, LinearSegmentedColormap

viridis = cm.get_cmap('viridis', 8)
print(viridis)

##############################################################################
# The object ``viridis`` is a callable, that when passed a float between
Expand Down Expand Up @@ -74,7 +73,6 @@
# float array between 0 and 1.

copper = cm.get_cmap('copper', 8)
print(copper)

print('copper(range(8))', copper(range(8)))
print('copper(np.linspace(0, 1, 8))', copper(np.linspace(0, 1, 8)))
Expand Down