import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, np.pi*4, 100) y = np.cos(x) + np.sin(x) xmin, xmax = 0, np.pi*4 ymin, ymax = -2, 2 fig, ax = plt.subplots() ax.plot(x, y) ax.set_xlim(xmin, xmax) ax.set_ylim(ymin, ymax) #ax.axis([xmin, xmax, ymin, ymax]) # x軸とy軸の両方の範囲をまとめて設定