Issue
Using Pycharm and Matplotlib e.g. with:
import matplotlib.pyplot as plt
import numpy as np
my_random = np.random.random(5)
plt.plot(my_random)
plt.show()
gives easily a plot, that appears in Pycharm Professional Edition 2017.3 (Ubuntu 14.04) in the SciView window:
If I zoom in to the plot, it gets very coarse and I cannot analyse details anymore:
Is it possible to have this plot as a vector plot, so that details are maintained when zooming in?
Or can I plot in a more "native" (in the sense of closer to matplotlib, as this plot seems Pycharm specific) way, so that zooming is done in a vectorized and not bitmap way?
Solution
I don't know anything about pycharm.
But you should try increasing the DPI of the figure (and avoid relying on the pyplot
API's state machine):
from matplotlib import pyplot
fig = pyplot.figure(dpi=120)
ax = fig.add_subplot(1, 1, 1)
ax.plot([1, 2, 3], [3, 1, 2], 'ko')
Explicitly creating the figure will give you much more control in the long run.
Note the the display DPI of the figure isn't necessarily the resolution it will be saved at:
fig.savefig('test.png', dpi=600, bbox_inches='tight')
Answered By - Paul H
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.