We're updating the default styles for Matplotlib 2.0

Learn what to expect in the new updates


Previous topic

pie_and_polar_charts example code: pie_demo_features.py

Next topic

pie_and_polar_charts example code: polar_scatter_demo.py

This Page

pie_and_polar_charts example code: polar_bar_demo.pyΒΆ

(Source code, png, hires.png, pdf)

Demo of bar plot on a polar axis.
import numpy as np
import matplotlib.pyplot as plt

N = 20
theta = np.linspace(0.0, 2 * np.pi, N, endpoint=False)
radii = 10 * np.random.rand(N)
width = np.pi / 4 * np.random.rand(N)

ax = plt.subplot(111, polar=True)
bars = ax.bar(theta, radii, width=width, bottom=0.0)

# Use custom colors and opacity
for r, bar in zip(radii, bars):
    bar.set_facecolor(plt.cm.jet(r / 10.))


Keywords: python, matplotlib, pylab, example, codex (see Search examples)