flâneur

Create 2D bar graphs in different planes — Matplotlib 3.6.2 documentation

matplotlib.org · 177 words · saved by 1 readers

© Copyright 2002–2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012–2022 The Matplotlib development team. Created using Sphinx 5.3.0.

Note Go to the end to download the full example code. Demonstrates making a 3D plot which has 2D bar graphs projected onto planes y=0, y=1, etc. import matplotlib.pyplot as plt import numpy as np # Fixing random state for reproducibility np.random.seed(19680801) fig = plt.figure() ax = fig.add_subplot(projection='3d') colors = ['r', 'g', 'b', 'y'] yticks = [3, 2, 1, 0] for c, k in zip(colors, yticks): # Generate the random data for the y=k 'layer'. xs = np.arange(20) ys = np.random.rand(20) # You can provide either a single color or an array with the same length as # xs and ys. To…

saved by

related reading