October 2018
Beginner to intermediate
676 pages
18h 30m
English
We will now plot the same figure using the axisartist and axes_grid1 toolkits. The steps to be followed are the same, so we will not describe each step here, but rather list the entire code in one block. We will explain the key differences between the two methods thereafter.
Here is the full code block for plotting the graph using the axisartist and axes_grid1 toolkits:
from mpl_toolkits.axes_grid1 import host_subplotimport mpl_toolkits.axisartist as AAimport matplotlib.pyplot as pltplt.figure()ax1 = host_subplot(111, axes_class=AA.Axes)ax1.axis["top"].toggle(all=False) # switch off ticks and ticklabels for the top axisax2 = ax1.twinx()ax3 = ax1.twinx()new_fixed_axis = ax3.get_grid_helper().new_fixed_axisax3.axis["right"] ...
Read now
Unlock full access