1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| import os, math import numpy as np import pandas as pd
import scipy.stats as st
import seaborn as sns import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages import matplotlib.transforms as transforms
mpl.rcParams['figure.dpi'] = 120 mpl.rcParams['font.size']=10.5 mpl.rcParams['font.size']=9 cm = 1/2.54
fig, axes = plt.subplots(figsize=(10*cm,10*cm), facecolor='w') fig, axes = plt.subplots(nrows =2 ,ncols=2, figsize=(20*cm,10*cm), facecolor='w') axes = axes.flatten()
fig.tight_layout() fig.savefig(r'...\f1.png',dpi=300,bbox_inches='tight',pad_inches=0.5,facacolor='w') fig.savefig(r'...\f1.svg',dpi=300,bbox_inches='tight',pad_inches=0.2,facacolor='w') save_pdf = "./figure/test.pdf" fig.savefig(save_pdf,format='pdf')
pdf = PdfPages(save_pdf);fig.savefig(pdf,format='pdf');pdf.close()
|