适用于MATLAB的matplotlib等效truesize() [英] matplotlib equivalent for MATLABs truesize()

查看:205
本文介绍了适用于MATLAB的matplotlib等效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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆