适用于MATLAB的matplotlib等效truesize() [英] matplotlib equivalent for MATLABs truesize()
问题描述
我是matplotlib和python的新手,我想显示一个图像,以便该图像的1个像素实际上由图中的1个像素表示.在MATLAB中,这是通过命令truesize()
实现的.如何在Python中执行此操作?
I am new to matplotlib and python and would like to display an image so that 1 pixel of the image is actually represented by 1 pixel in the figure. In MATLAB, this is achieved with the command truesize()
. How can I do this in Python?
我尝试使用imshow()
参数以及set_dpi()
和set_figwidth()/set_figheight()
,但是没有运气.
I tried playing around with the imshow()
arguments as well as set_dpi()
and set_figwidth()/set_figheight()
, but with no luck.
谢谢.
推荐答案
If you want to create images right down to the pixel level, why not use PIL in the first place? That way you wouldn't have to programatically calculate your true drawing area by substracting margins, labels and axis widths from the figure extend.
这篇关于适用于MATLAB的matplotlib等效truesize()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!