Pycharm slow and matplotlib problems

Hi,

 

I've recently switched to pycharm as my maijn development environment for python and in general I'm quite happy with how it works. However I encountered some problems. First of all I find running script quite slow, not to mention if I show a plot using matplotlib then the interactive plot is quite slow compared to simply using IDLE.

I thought about solving this by not actually showing a plot, but rather just saving the figure. However it seems that even if I don't explictily call show() that is called in the background and then closed again. Any idea what is going on?

 

My code:

# plot exchange rate over the years
fig, ax = plt.subplots(1, 1, figsize=(12,9))
ax.plot(years, data, color=c[0])

# set figure properties
ax.set_title('Rate')
ax.set_xlim([min(years), max(years)])
ax.set_ylabel('Rate per x')
ax.set_xlabel('Source: '+source, horizontalalignment='right', x=1.0, fontsize=9)
ax.xaxis.set_ticks(years[::2])
fig.savefig('rate.png', dpi=144, bbox_inches='tight')
plt.close(fig)

 

The pycharm information:

PyCharm 2017.3.2 (Community Edition)
Build #PC-173.4127.16, built on December 18, 2017
JRE: 1.8.0_152-release-1024-b8 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 7 6.1

 

Any idea how I can at least switch off the opening of the interactive gui for a plot (even if I'm not calling show())? This would already help a lot. If there are ways to make it all faster that would be even beter.

Please sign in to leave a comment.