Frage

Using pylab (matplotlib) in Python, I'd like to make plots for a scientifc conference poster. However, using a decent dpi resolution and the correct size in inches/centimetres, all elements of the plots are way too small to print big. The image will be roughly 30 cm x 20 cm large for an A0 format poster, rather than 15 cm x 10 for a standard A4 page.

Now I'd like to avoid to reserach and adjust all plot properties like text sizes (axes, ticks, legend), line widths, tick sizes and so on individually. Basically I'd like to scale-up all properties as if I had saved the plot with standard settings but later scaled up the entire image (without it getting pixelated).

Isn't there a pre-setting for large print media like this? Or maybe someone can provide a code snippet to set all relevant properties.

Thank you.

War es hilfreich?

Lösung

If you save your figure as a pdf, (or svg, or any other vector graphics format) then it will scale indefinitely without any 'pixelation' because vector graphics have no pixels.

Assuming you don't want to change the relative font size for the purposes of proportionality (not image resolution), it's as simple as:

plt.savefig('figures/figname.pdf')

If you want to change the overall proportionality of the fonts with one step, you can use figsize, which changes the size of the figure without changing the sizes of any of its parts (text, markers, linewidth).

plt.figure(figsize=(8,6)) # (width, height)

or if you've already created the figure and have a handle on it:

fig.set_figwidth(8)
fig.set_figheight(6)

So if you make the figsize larger, then in effect you're making all the figure elements smaller (assuming your final figure has a fixed size on the poster). To increase all the font/marker/linewith sizes, just make your figsize smaller.

Note, the scalability of a pdf or svg depends on the compatibility of the program that you're using to make the poster to work well with vector graphics (which is something you'll want anyway), so be sure not to import the images as jpg or png or something.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top