You are reading documentation for the unreleased version of Matplotlib. Try searching for the released version of this page instead?
Applications are open for the 2018 John Hunter Matplotlib Summer Fellowship. Apply now!
Version 2.2.2.post1768+g23420a4c1
Fork me on GitHub

Related Topics

Frontpage plot exampleΒΆ

This example reproduces the frontpage simple plot example.

import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import numpy as np

with cbook.get_sample_data('membrane.dat') as datafile:
    x = np.fromfile(datafile, np.float32)
# 0.0005 is the sample interval

fig, ax = plt.subplots()
ax.plot(x, linewidth=4)
ax.set_xlim(5000, 6000)
ax.set_ylim(-0.6, 0.1)
fig.savefig("membrane_frontpage.png", dpi=25)  # results in 160x120 px image

Keywords: matplotlib code example, codex, python plot, pyplot Gallery generated by Sphinx-Gallery