How to plot 5 subplots sharing x and y axes in Python -
as in title, have 5 plots in python want produce. how plot 5 of these share same axes? thanks
you can use subplot
sharex
, sharey
options. example:
import numpy np import pylab pl x = np.linspace(-1, 1, 100) y = np.zeros((5, 100)) in range(5): y[i] = x**i ax = [] kw = {} in range(5): if > 0: kw ={'sharex': ax[0], 'sharey': ax[0]} ax.append(pl.subplot(3, 2, i+1, **kw)) ax[i].plot(x, y[i])
Comments
Post a Comment