GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Plot types
  • User guide
  • Tutorials
  • Examples
  • Reference
  • Contribute
  • Releases
  • Gitter
  • Discourse
  • GitHub
  • Lines, bars and markers
  • Line plot
  • Linestyles
  • Dashed line style configuration

This view

  • Original page
  • New address

GeezerVison is showing matplotlib.org — Basic plot — Matplotlib 3.11.2 documentation

Note

Go to the end to download the full example code.

Basic plot#

A basic plot using the The implicit "pyplot" interface.

  • plot plots the data y versus x as lines and/or markers.

  • title, xlabel and ylabel set the title, x-axis label and y-axis label.

  • show displays the plot.

import matplotlib.pyplot as plt
import numpy as np

x = np.arange(0.0, 2.0, 0.01)
y = np.sin(2 * np.pi * x)

plt.plot(x, y)
plt.title("A basic plot using pyplot")
plt.xlabel('Time [s]')
plt.ylabel('Voltage [mV]')
plt.show()
A basic plot using pyplot

References

The use of the following functions, methods, classes and modules is shown in this example:

  • matplotlib.pyplot.plot

  • matplotlib.pyplot.title

  • matplotlib.pyplot.ylabel

  • matplotlib.pyplot.ylabel

  • matplotlib.pyplot.show

Download Jupyter notebook: pyplot_simple.ipynb

Download Python source code: pyplot_simple.py

Download zipped: pyplot_simple.zip

Gallery generated by Sphinx-Gallery

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.