John Hunter wrote: > On Thu, Jul 24, 2008 at 10:00 PM, Ryan May <[EMAIL PROTECTED]> wrote: > >> What else is confusing is how that relates to DPI. When I change the >> figure's dpi, using set_dpi, (and redraw), I get physically *bigger* barbs. >> To me, if I'm actually specifying pixels, there's no way that they should >> get bigger when I change the DPI. > > When you increase the dpi, the canvas gets bigger (inches*dpi equals > canvas size in pixels). If you are drawing in pixels, and not > scaling, the barbs should look smaller, since they are a smaller > proportion of the canvas size. So if this explanation is right, the > barbs will look smaller with larger dpi. > >> Then I also can't figure out what the PS backend is doing. If PS is >> hardcoded to 72 DPI, why does passing dpi=72 to savefig() have any effect? > > ps should be unaffected, but dpi dependent backends will. By setting > the dpi to be 72, it should make the *other* backend look like the ps > backend and the ps backend should be unaffected.
Ok, I think I found our problem, at line 859 of backend_ps.py (inside _print_ps()): self.figure.set_dpi(72) # Override the dpi kwarg dpi = kwargs.get("dpi", 72) The problem here is that while it sets the figure dpi here to 72, it's using the dpi that's passed in down the chain. Since I don't give it a dpi explicity, it grabs the default dpi from my matplotlibrc, which has it set to 300 dpi. So 300 is getting passed down into the chain and I believe the drawing commands are using 300 dpi. If I change the second line above to dpi = 72, I get the proper results. So what's the proper fix in this case, or is this it? It'd probably be good to get this in for a release. There were a couple other things I noticed: 1) The canvas.print_figure() method goes to the trouble of saving the facecolor and edgecolor before resetting them to what's passed in for purposes of writing out the image. Then later, backend_ps._print_figure() does the same thing a few calls down the stack. Is one of these redundant, or is there a reason for the duplication? 2) backend_ps._print_figure() uses the md5 module to create a temporary filename. This module is deprecated in python 2.5 and removed (I believe) in 3.0, replaced by hashlib. Is there any opposition to changing the direct use of md5.md5() to using a try...except to import md5() from it's proper place? Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel