为什么在PyCharm和Spyder IDE中显示的matplotlib图形与在Jupyter Notebook中显示的



我正试图在Pycharm或Spyder IDE中显示我的matplotlib图形,所以我正在使用Jupyter Notebook的代码。然而,IDE中的数字显示错误。

例如,在Jupyter笔记本中,图形显示如下:Juyter笔记本上的显示图

另一方面,如果我在Pycharm或Spyder IDE上运行相同的代码,则该图显示如下:Pycharm&Spyder IDE

我不认为我的代码运行的环境会以任何方式影响代码。但是,我仍然会添加下面的代码。

# Data Visualisation
# countplot of every variable
for i, col in enumerate(df.columns):
plt.figure(i) # create a figure for each feature of the dataset
sns_plot = sns.countplot(x=col, data=df) # plot the figure for the specific feature and 
# its corresponding values

Jupyter和IDE之间的默认绘图大小似乎不同。

最新更新