October 2018
Beginner to intermediate
676 pages
18h 30m
English
Here is another example of using a mix of centimeters and inches on the x and y axis. We have four bar plots with the same input data, plotted on a 2 x 2 grid.
Import the required libraries:
import numpy as npfrom basic_units import cm, inchimport matplotlib.pyplot as plt
The following code plots the figure with four bar plots in a 2 x 2 grid:
cms = cm * np.arange(0, 21, 3)bottom = 0 * cmwidth = 0.8 * cm
fig, axs = plt.subplots(2, 2)
axs[0, 0].bar(cms, cms, bottom=bottom)axs[0, 0].set_xticks(cm * np.arange(0, 21, 3))
Read now
Unlock full access