Matplotlib: Subplots

Published: 11 February 2019
on channel: Gihan Panapitiya
6,445
96

Code:

import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

fig, ax = plt.subplots(3, 2, sharey=True, figsize=(7,10),
dpi=500)
x = np.arange(0,10,0.1)
y = np.sin(x)

ax[0,1].plot(x,y, label='sin(x)')

ax[1,0].plot(x,y, label='sin(x)')
ax[1,0].plot(x,2*y, label='2*sin(x)')

remove tick labels
ax[0,0].set_xticklabels([])
ax[0,0].set_xticks([])

ax[0,0].set_ylabel("y axis of [0,0]")
ax[0,0].set_xlabel("x axis of [0,0]")


ax[1,0].legend(loc=1)

fig.text(0.05, 0.5, "sin(y)", rotation='vertical', fontsize=18)

fig.text(0.5, 0.08, "x", rotation='horizontal', fontsize=18)

plt.subplots_adjust(wspace=.2, hspace=.3)


On this page of the site you can watch the video online Matplotlib: Subplots with a duration of hours minute second in good quality, which was uploaded by the user Gihan Panapitiya 11 February 2019, share the link with friends and acquaintances, this video has already been watched 6,445 times on youtube and it was liked by 96 viewers. Enjoy your viewing!