1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import os import matplotlib.pyplot as plt import numpy as np from numpy.random import randn os.chdir(r'D:\data\scripts\web1\ex20') os.getcwd() fig = plt.figure() ax1=fig.add_subplot(2,2,1) ax2=fig.add_subplot(2,2,2) ax3=fig.add_subplot(2,2,3) ax3.plot(randn(50).cumsum(),'k--') ax1.hist(randn(100),bins=20,color='k',alpha=0.3) ax2.scatter(np.arange(30),np.arange(30)+3*randn(30)) fig.suptitle('Figure and subplots') plt.savefig("example20.png", dpi=100) plt.show() plt.close() <img class=" wp-image-112 aligncenter" src="https://gantovnik.com/bio-tips/wp-content/uploads/2019/01/example20.png" alt="example20" width="545" height="363" /> |
Recent Comments