SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: Kuzminski, S. R <SKu...@fa...> - 2004年03月08日 16:41:08
I got the .51 release, looks great. I need to set_antialiased() on the
Renderer, but I'm not sure how to get the renderer object correctly. If
I call gca() I get the SubPlot, but the renderer member is None. Any
advice would be appreciated.
=20
thanks,
S
From: John H. <jdh...@ac...> - 2004年03月08日 16:54:40
>>>>> "Kuzminski," == Kuzminski, Stefan R <SKu...@fa...> writes:
 Kuzminski,> I got the .51 release, looks great. I need to
 Kuzminski,> set_antialiased() on the Renderer, but I'm not sure
 Kuzminski,> how to get the renderer object correctly. If I call
 Kuzminski,> gca() I get the SubPlot, but the renderer member is
 Kuzminski,> None. Any advice would be appreciated.
There is no way to set antialiased on the renderer itself, just on the
individual objects (lines etc).
 
 plot([1,2,3], antialiased=False)
or 
 lines = plot(x1,y1,x2,y2)
 set(lines, 'antialiased', False)
or set lines.antialiased in matplotlibrc to the default you want.
Unfortunately, agg does not yet respect antialiased == False for all
primitives, currently only lines.
See also
 http://matplotlib.sourceforge.net/faq.html#MATPLOTLIBRC
 http://matplotlib.sourceforge.net/faq.html#CUSTOM
Can you tell me what you're trying to do?
JDH
From: Al S. <a.d...@wo...> - 2004年03月08日 17:50:18
In order to get the size of the overall plot window to anywhere near
full screen, I've had to use something like 
	figure(1, figsize=(18,12), dpi=72)
or	figure(1, figsize=(9,6), dpi=144)
Both produce the same overall size plot window (11.25" wide by 8" tall),
but in the latter case, the text size is much larger than in the latter
case. Likewise the linewidths.
Can you please explain the interaction among the dpi value, the font
sizes displayed, and the overall plot size.
Note: If I omit the dpi parameter, the plot window remains at its
default (approx 4" x 3") size. The only way I've gotten the window size
to change at all is by adding the dpi parameter to the fiigure() call,
hence the question.
FYI, this is under RH linux 9, with XFree86 4.3.0-2.
The display is a 15" diagonal (12" horizontal, 9" vertical) Dell laptop
with 1400x1050 NVIDIA GeForce 4 (generic) graphics. Naively, this looks
like the H-res is 1400/12" = 116.66 dpi and the V-res is 1050/9" =
116.66 dpi also.
Should I set dpi to the resolution of my display (117) or to the
resolution of the X fonts (75 or 100)?
Thanks,
-- 
Al Schapira <a.d...@wo...>
From: John H. <jdh...@ac...> - 2004年03月08日 21:35:39
>>>>> "Al" == Al Schapira <a.d...@wo...> writes:
 Al> In order to get the size of the overall plot window to
 Al> anywhere near full screen, I've had to use something like
 Al> 	figure(1, figsize=(18,12), dpi=72) or figure(1,
 Al> figsize=(9,6), dpi=144)
 Al> Both produce the same overall size plot window (11.25" wide by
 Al> 8" tall), but in the latter case, the text size is much larger
 Al> than in the latter case. Likewise the linewidths.
 Al> Can you please explain the interaction among the dpi value,
 Al> the font sizes displayed, and the overall plot size.
Hi Al, 
This is a complicated issue and I don't have a full answer for you.
The problem is compounded by the fact that I am trying to make the DPI
parameter produce figures that look the same across the backends, and
different backends have often have an additional parameter that makes
assumptions about the number of pixels per inch on your display - eg
gd assumes 96, and these are not under my control. 
The total figure width in pixels is figure width in inches * dpi;
ditto for height. If you set dpi to your device PIXELS_PER_INCH, the
width should be correct if you measure it on the screen with a ruler.
You will probably need to set PIXELS_PER_INCH for the backend you are
using to be correct for your display. This is a parameter the
respective backend files, eg, in matplotlib/backends/backend_gtk.py.
For backend_agg, you will have to change it both in
src/_backend_agg.cpp and matplotlib/backends/backend_agg.py. This is
something I would like to rationalize and perhaps move to the rc file.
I suggest setting it to your display width / pixels width, eg, 116 in
your example. Then
 figure( (8,6), dpi=116)
should produce a an 8 inch by 6 inch figure. Let me know. Then
default dpi can be set in the rc file.
None of this matters, of course, for PS, which is resolution
independent.
dpi is not really suitably named because of this additional parameter
PIXELS_PER_INCH. dpi is really a resolution parameter. When you
increase dpi, the relative sizes of everything in your image should
increase proportionately (line widths, text sizes, etc) but you have
more pixels of resolution. When you increase figure size for a give
dpi, everything should appear smaller because the physical size of the
objects in your canvas haven't changed, but your canvas has increased.
I'm open to suggestions on how to make this better.
JDH
From: matthew a. <ma...@ca...> - 2004年03月08日 23:27:48
It seems to me, from the user's point of view, that the DPI is a rendering
option, not a plotting option. I should be able to take the same plot:
p = plot(sin(x))
and render it to screen 
show(p, dpi=96, size=(8, 6))
OR
show(p, pixelsize=(768, 576))
or render it for printing:
savefig('p.png', dpi=300, size=(6, 4))
OR
savefig('p.png', pixelsize=(1800, 1200))
OR
savefig('p.eps', size=(6, 4))
I think people are going to want different DPI settings for screen vs. 
printing. So perhaps dpi should be an option to show() and savefig()
rather than to plot?
And rather than having different DPI defaults for each backend, I would 
have thought it better to have two global default DPI settings, one for 
the screen and one for the printer. You would also want two default plot 
sizes in inches.
In a sane world you wouldn't need to set the DPI for the screen, you could
trust X or Windows to provide it, but in practice what X says isn't always
useful.
You might even consider adding a print() command that renders a plot with 
the default printing settings to a file (or even straight to the 
printer?). Perhaps savefig() should use the default printing settings when 
exporting an .eps file? (Although the DPI is ignored the plot size is 
still relevant.)
I hope you find these ponderings useful. I am still a bit ignorant about
aspects of matplotlib so I'll hope you'll excuse me for that.
Cheers,
Matthew.
On Mon, 8 Mar 2004, John Hunter wrote:
> None of this matters, of course, for PS, which is resolution
> independent.
> 
> dpi is not really suitably named because of this additional parameter
> PIXELS_PER_INCH. dpi is really a resolution parameter. When you
> increase dpi, the relative sizes of everything in your image should
> increase proportionately (line widths, text sizes, etc) but you have
> more pixels of resolution. When you increase figure size for a give
> dpi, everything should appear smaller because the physical size of the
> objects in your canvas haven't changed, but your canvas has increased.
> 
> I'm open to suggestions on how to make this better.
> 
> JDH
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /