在jupyter notebook,调用seaborn和pyplot画散点图
%matplotlib inline
import pandas as pd
import numpy as np
import seaborn as sns
df = pd.read_excel(r'D:\xxx.xlsx',
usecols = [1,2,3])
BcrBc, MrMs, Interval = df['Bcr/Bc'], df['Mr/Ms'], df['Interval']
import matplotlib.pyplot as plt
plt.style.use(['science','ieee','no-latex'])
fig,ax = plt.subplots(figsize=[6,5], dpi=300)
ax.set_xlim(0,10)
ax.set_ylim(0,.6)
scatter = sns.scatterplot(x = BcrBc, y = MrMs, hue = Interval, alpha = .6, marker = '.')
ax.legend(loc = [.75,.6])
ax.set_ylabel('M$_\mathregular{r}$/M$_\mathregular{s}$')
ax.set_xlabel('B$_\mathregular{cr}$/B$_\mathregular{c}$')
ax.axvline(x = 1.5, linewidth = .5)
ax.axvline(x = 4, linewidth = .5)
ax.axhline(y = .05, linewidth = .5)
ax.axhline(y = .5, linewidth = .5)
plt.text(.5,.542,'SD',fontsize = 12)
plt.text(2.4,.442,'PSD',fontsize = 12)
plt.text(6.8,.02,'MD',fontsize = 12)
plt.show()
plt.savefig('Day Plot.eps', dpi=300)
输出并保存图片后,图片(正常显示)下方出现“<Figure size 1980x1500 with 0 Axes>”,导出jpg,png,tiff,eps等文件并下载后都是空白
尝试过在导入库前加 “%matplotlib inline”,但依然不行
想要保存正常输出的eps等格式文件