[Matplotlib-users] Exporting plot with given scale and DPI

Alexander Bruy alexander.bruy at gmail.com
Mon Jan 8 12:45:43 EST 2018


It is not clear from the docs if this function preserves dimensions and DPI
when exporting plot into PNG.

Also as I understand it resizes plot on screen and does not play well with
large sizes.

2018-01-08 19:20 GMT+02:00 Jody Klymak <jklymak at uvic.ca>:
> Does `fig.set_size_inches()` do what you want?
>
> Cheers,   Jody
>
>> On 8 Jan 2018, at 08:44, Alexander Bruy <alexander.bruy at gmail.com> wrote:
>>
>> Hi all.
>>
>> I use matplotlib inside PyQt app and want to export plot into PNG image with
>> some user-defined scale and DPI. So after printing that image I should be able
>> to measure on the paper according to the scale.
>>
>> For example, length of the profile line is 500m (this is my x-axis),
>> scale set to 1:10000 and DPI is 150. 500m at 1:10000 should result in
>> a 5cm print out. Taking 150 DPI into account resulting bitmap should
>> be 295 pixels wide:
>>
>> 1cm is 0.393701 inches
>> 5cm is 1.968505 inches
>> 1.968505inches * 150DPI = 295.27575 px
>>
>> Also it is necessary to take into account that resulting image may be
>> really big, for
>> example if profile line length is several kilometers and DPI is 600.
>>
>> As I can see there is a 'dpi' parameter in the savefig() call, but I
>> can't figure out how
>> to adjust size of the existing figure when exporting. Can you help me?
>>
>> Thanks
>> --
>> Alexander Bruy
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users at python.org
>> https://mail.python.org/mailman/listinfo/matplotlib-users
>
> --
> Jody Klymak
> http://web.uvic.ca/~jklymak/
>
>
>
>
>



-- 
Alexander Bruy


More information about the Matplotlib-users mailing list