Re: [Matplotlib-users] dpi
Hi, Le 19/10/2012 06:48, Jae-Joon Lee a écrit : Figuring out the dpi of the screen, I have no clue at this moment. Maybe this is something a gui expert can answer. I'm certainly not a gui expert, but as a PyQt user, I know screen resolution is indeed Python-accessible with PyQt. (I guess other toolkits provide their own methods) I've made a quick script that prints the screen X and Y resolution (requires PyQt). Reference links to PyQt API docs are included. In my case, it's 96 dpi, and that what I use in my matplotlibrc file for the figure.dpi property. But I use a higher value (say 150) for savefig.dpi so that I get better resolution when saving PNG images. I agree with Nikolaus that the dpi value for displaying figures would be better get by the software, if possible. Maybe a property like figure.dpi='auto' should activate such a behavior. But this would require many code duplicates, one for each gui toolkit. Best, Pierre #!/usr/bin/python # -*- coding: UTF-8 -*- Diplay the Screen resolution information from PyQt References --- http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qapplication.html#desktop http://qt-project.org/doc/qt-4.8/qapplication.html#desktop http://lists.trolltech.com/qt-interest/2008-08/thread00258-0.html Pierre Haessig â October 2012 import sys from PyQt4.QtGui import QApplication app = QApplication(sys.argv) desktop_widget = app.desktop() print('Screen resolution:') print('%d x %d DPI' % (desktop_widget.physicalDpiX(), desktop_widget.physicalDpiY() )) signature.asc Description: OpenPGP digital signature -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] dpi
Yeah, that's what I feared. But in the mean time, are there any best practices to minimize undesired effects like the one above? For example, are there any other functions that need special parameters to not raster their output when writing to a vector format? And is there a way to get a figure on the screen with the right size when I don't know what dpi the monitor is running with? As I said, if you use interpolation=none with your inshow, the original image will be sent to the backends. Figuring out the dpi of the screen, I have no clue at this moment. Maybe this is something a gui expert can answer. Regards, -JJ -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] dpi
Jae-Joon Lee lee.j.joon-re5jqeeqqe8avxtiumw...@public.gmane.org writes: On Fri, Oct 12, 2012 at 3:39 AM, Nikolaus Rath nikolaus-bth8mxji...@public.gmane.org wrote: matplotlib actually rescales the raw imshow data when saving to a vector format? Why is that? I think it should embed the bitmap with full resolution in the vector file and rely on the consumer of the vector file to scale it to whatever resolution is supported by the display device. imshow supports interpolation and that's why rasterization comes in. If you turn off interpolation (w/ interpolation=none), the original image will be embedded. Of course dpi has no meaning in this case. However, I agree with you that dpi should be a property of the backend only, not the figure. But I am not sure if this can be fixed soon. It will be difficult and will take lots of effort I think. Yeah, that's what I feared. But in the mean time, are there any best practices to minimize undesired effects like the one above? For example, are there any other functions that need special parameters to not raster their output when writing to a vector format? And is there a way to get a figure on the screen with the right size when I don't know what dpi the monitor is running with? Best, -Nikolaus -- »Time flies like an arrow, fruit flies like a Banana.« PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] dpi
Hello, I'm confused by the dpi property of figures that can be set in matplotlibrc or passed to pyplot.figure(). It seems to me that dpi is really a property of the backend, not the figure, and the only place to specify it ought to be when saving into a bitmap file. For example, when showing a figure on the screen, I really want matplotlib to use the physical dpi of the monitor rather than any default value. When saving the figure in some vector graphics format, I don't see what the meaning of the dpi is at all. Am I missing something? Best, -Nikolaus -- »Time flies like an arrow, fruit flies like a Banana.« PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] dpi
On Thu, Oct 11, 2012 at 4:00 PM, Nikolaus Rath nikol...@rath.org wrote: When saving the figure in some vector graphics format, I don't see what the meaning of the dpi is at all. Sure, I use `dpi=` all the time for vector formats. Purely because when you make calls to `imshow`, you get a rasterised image embedded in a figure with vector text and tickmarks and labels, for example. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] dpi
Damon McDougall damon.mcdougall-re5jqeeqqe8avxtiumw...@public.gmane.org writes: On Thu, Oct 11, 2012 at 4:00 PM, Nikolaus Rath nikolaus-bth8mxji...@public.gmane.org wrote: When saving the figure in some vector graphics format, I don't see what the meaning of the dpi is at all. Sure, I use `dpi=` all the time for vector formats. Purely because when you make calls to `imshow`, you get a rasterised image embedded in a figure with vector text and tickmarks and labels, for example. matplotlib actually rescales the raw imshow data when saving to a vector format? Why is that? I think it should embed the bitmap with full resolution in the vector file and rely on the consumer of the vector file to scale it to whatever resolution is supported by the display device. Best, -Nikolaus -- »Time flies like an arrow, fruit flies like a Banana.« PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] dpi
On Fri, Oct 12, 2012 at 3:39 AM, Nikolaus Rath nikol...@rath.org wrote: matplotlib actually rescales the raw imshow data when saving to a vector format? Why is that? I think it should embed the bitmap with full resolution in the vector file and rely on the consumer of the vector file to scale it to whatever resolution is supported by the display device. imshow supports interpolation and that's why rasterization comes in. If you turn off interpolation (w/ interpolation=none), the original image will be embedded. Of course dpi has no meaning in this case. However, I agree with you that dpi should be a property of the backend only, not the figure. But I am not sure if this can be fixed soon. It will be difficult and will take lots of effort I think. -JJ -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users