November 2018
Beginner to intermediate
214 pages
5h 2m
English
This section describes how to align our text and put it on the figure object rather than the axis objects.
The following is the code for the two-axis figure, with a sine curve and a cosine curve seperated by spine:
# Figure textgs = mpl.gridspec.GridSpec(1,2, wspace=0.0)nums = np.arange(0,10,0.1)plt.subplot(gs[0])plt.plot(nums, np.sin(nums))plt.gca().spines['right'].set_visible(False)plt.gca().yaxis.set_ticks_position('left')plt.subplot(gs[1])plt.plot(nums, np.cos(nums))# plt.gca().yaxis.set_visible(False)# plt.gca().spines['left'].set_visible(False)plt.gca().xaxis.set_major_locator(mpl.ticker.MaxNLocator(5, prune='lower'))# plt.figtext(0.5,0.5, "trig functions", horizontalalignment='center')
To span the ...
Read now
Unlock full access