Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

matplotlib - increase resolution to see details

I have a big process that is composed of tasks (about 600), and I created a figure to watch the order they are launched with and the time they take. To do this, I used matplotlib and a barh.

The figure is ok (my 1st matplotlib success !), but:

  • I would like to see the details and zoom on the picture when exported (as PNG, for instance), as the zoom option allows when matplotlib displays the result with the show() command
  • the legends of the Y axis are too close and unreadable

I tried to increase the resolution as said in this other SO post, this is better but details are not precise enough. Here are my results so far:

  • full result

full

  • zoom with matplotlib

zoom

Do you know how I could improve readability ? Thanks a lot (else, all my efforts would be useless, I'm afraid...)

PS: I'm using matplotlib 1.1.1 and python 2.7.

like image 254
Emmanuel Avatar asked Aug 30 '12 08:08

Emmanuel


People also ask

What is matplotlib dpi?

The dpi method of figure module of matplotlib library is the resolution in dots per inch. Syntax: fig.dpi. Parameters: This method does not accept any parameters. Returns: This method returns resolution in dots per inch.

How do I save a high resolution figure in Python?

To get a high-quality image, we can use . eps image format. You can increase the dot per inch value, i.e., dpi. Using savefig() method, we can save the image locally.

How do I make my matplotlib marker thicker?

You can use markeredgewidth (or mew ). You'll want to combine it with markersize , otherwise you get thick but tiny markers. Show activity on this post. Use markeredgewidth in connection with markersize .


1 Answers

I managed to do so, on Evert's advice, by using a very big resolution with a very small font. Here are the most important steps:

import pylab as pl pl.figure(figsize=(70, 70)) # This increases resolution pl.savefig('test.eps', format='eps', dpi=900) # This does, too pl.annotate(..., fontsize='xx-small', ...) 
like image 106
Emmanuel Avatar answered Sep 28 '22 00:09

Emmanuel