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
  • Pairwise data
  • plot(x, y)
  • scatter(x, y)
  • bar(x, height)

This view

  • Original page
  • New address

GeezerVison is showing matplotlib.org — boxplot(X) — Matplotlib 3.11.2 documentation

Note

Go to the end to download the full example code.

boxplot(X)#

Draw a box and whisker plot.

See boxplot.

boxplot plot
import matplotlib.pyplot as plt
import numpy as np

plt.style.use('_mpl-gallery')

# make data:
np.random.seed(10)
D = np.random.normal((3, 5, 4), (1.25, 1.00, 1.25), (100, 3))

# plot
fig, ax = plt.subplots()
VP = ax.boxplot(D, positions=[2, 4, 6], widths=1.5, patch_artist=True,
                showmeans=False, showfliers=False,
                medianprops={"color": "white", "linewidth": 0.5},
                boxprops={"facecolor": "C0", "edgecolor": "white",
                          "linewidth": 0.5},
                whiskerprops={"color": "C0", "linewidth": 1.5},
                capprops={"color": "C0", "linewidth": 1.5})

ax.set(xlim=(0, 8), xticks=np.arange(1, 8),
       ylim=(0, 8), yticks=np.arange(1, 8))

plt.show()

Download Jupyter notebook: boxplot_plot.ipynb

Download Python source code: boxplot_plot.py

Download zipped: boxplot_plot.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.