Issue
I created a GUI using PyQT Designer and inserted matplotlib figures. I developed the program in Anaconda / Spyder, and sized the graphs the way I wanted.
However, when run from a windows Command Prompt, or Anaconda Prompt (Anaconda 3), or Anaconda Powershell Prompt (Anaconda 3), using the command "python snappy.py", all the features in matplotlib get bigger....the data points are bigger, the lines including the axes are thicker, all the fonts are bigger. This makes the data more difficult to see, and wreaks havoc with the layout (labels get pushed off the canvas). Spyder and Anaconda prompt are run on the same computer, using the same installation of Anaconda.
What causes the difference, and can I control what "size" or "resolution" my matplotlib figures are.
Solution
I "figured" this out (pardon the pun). I added this to the top of my code.
plt.rcParams['figure.dpi'] = 60
The default resolution is normally 100. When I hard-coded it to 100 in my script, it replicated the "fat" lines and "large" fonts that I was seeing when running from the command prompt. When I lowered this value in my code to about 70 it matched what I had previously seen in Spyder.
So the default resolution of matplotlib running in my Spyder installation is different somehow.
Answered By - Ryan MacDicken
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.