SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S

1
(10)
2
(12)
3
(6)
4
(5)
5
(6)
6
(2)
7
(1)
8
(20)
9
(11)
10
(3)
11
(6)
12
(3)
13
(1)
14
(2)
15
(1)
16
(5)
17
(9)
18
(17)
19
(7)
20
21
(1)
22
(1)
23
(1)
24
25
(4)
26
(4)
27
28
(2)
29
(2)
30
(6)
31
(5)



Showing 5 results of 5

From: John H. <jdh...@ac...> - 2004年03月31日 14:02:04
>>>>> "Steve" == Steve Chaplin <ste...@ya...> writes:
 Steve> John, I noticed that when plotting sine waves
 Steve> (simple_plot.py for example) with the gtk backend that the
 Steve> lowest points are not plotted.
Hi Steve, thanks for letting me know. There is an off-by-one error
and it looks like and easy fix. For future reference, you may want to
consider using GTKAgg as your default GUI. This has the GTK widget
but uses agg for rendering. Agg supports subpixel rendering and so
isn't susceptible to one pixel errors that crop up in GTK in a number
of contexts. At low resolutions, these become particularly
noticeable. Other benefits over the GTK backend are alpha blending,
anti-aliased drawing, and faster image support -
http://matplotlib.sourceforge.net/backends.html#GTKAgg
 Steve> So I wrote a test script to plot a square, the result is
 Steve> that the left and top edges are plotted and the bottom and
 Steve> right edges are clipped off (I can pan the view to display
 Steve> the missing lines). I can't think of any reason why you
 Steve> would plot data points and then expect them to be clipped
 Steve> off, so to me it looks like an off-by-one error.
Now on to your problem.
In backend_gtk draw_rectangle, change
 x, y = int(x), self.height-int(math.ceil(y+height))
to
 x, y = int(x), self.height-int(y+height)
and the GraphicsContext.set_clip_rectangle method to
 def set_clip_rectangle(self, rectangle):
 GraphicsContextBase.set_clip_rectangle(self, rectangle)
 l,b,w,h = rectangle
 rectangle = (int(l), self.renderer.height-int(b+h)+1,
 int(w), int(h))
 self.gdkGC.set_clip_rectangle(rectangle) 
This fixes the bug, but doesn't handle your test case. The lines in
your example are still clipped, but there is a reason for that. In
your example, the lines are exactly where the axes lines will be
drawn. It's a judgment call whether you want to see the axes line or
your line at that location. In interactive navigation when you pan
and zoom around, it often happens that your data extend beyond the
axes lines; in this case you usually want a clean axes line not
partially obscured by your data.
If I set the clip so that the lines in your example are plotted, then
the axes lines are also overridden in other where the data extend
beyond the axes.
By tweaking the clip rectangle, eg 
 rectangle = (int(l), self.renderer.height-int(b+h),
 int(w+1), int(h+2))
you can get your lines drawn but then the axes lines are obscured, eg
in subplot_demo and arctest.
Try experimenting with a few different demos and clip settings to see
what you think is the best compromise; let me know.
In Agg this is less of a problem since agg uses pixel blending when
two pixels are drawn at the same location so the data pixel over the
axes line pixel is less glaring.
Cheers,
JDH
From: John H. <jdh...@ac...> - 2004年03月31日 13:16:29
>>>>> "Greg" == Greg Whittier <gr...@th...> writes:
 Greg> As a temporary solution you might try just transforming your
 Greg> r,theta data to x, y and then drawing a grid over it.
A nice workaround. You may want to add 
 axis('off')
To get rid of the background axes.
 
 Greg> I looked at the classes and with the loglog already done as
 Greg> an example, it shouldn't be too hard to add polar plotting.
 Greg> So far though I haven't got any further than printing out
 Greg> some of the code.
I was planning on taking a different tack, and derive a PolarAxes from
Axes and RadialAxis from Axis, etc, which uses circles rather then
lines for the radial gridlines, and so on. But you get so close with
so little code that your approach may be better. If you want to keep
forging ahead, I'm happy to leave the ball in your court.
On an unrelated note,
 from Numeric import *
 from matplotlib.matlab import *
is redundant because matplotlib.matlab imports all of numeric/numarray
as well as MLab, fft, and some stuff from LinearAlgebra and Matrix.
This is to provide a matlab like environment where most of the things
you need are there.
JDH
From: Steve C. <ste...@ya...> - 2004年03月31日 13:02:13
John,
I noticed that when plotting sine waves (simple_plot.py for example)
with the gtk backend that the lowest points are not plotted.
So I wrote a test script to plot a square, the result is that the left
and top edges are plotted and the bottom and right edges are clipped off
(I can pan the view to display the missing lines). I can't think of any
reason why you would plot data points and then expect them to be clipped
off, so to me it looks like an off-by-one error.
Test program:
from matplotlib.matlab import *
figure(1)
x = arange(0, 10+1, 1)
plot(x, x*0+10, 'r-',
 x, x*0, 'r-',
 x*0, x, 'r-',
 x*0+10, x, 'r-')
show()
Regards,
Steve
From: LUK S. <shu...@po...> - 2004年03月31日 10:18:05
John Hunter wrote:
>>>>>>"LUK" == LUK ShunTim <shu...@po...> writes:
> 
> 
> LUK> If matplotlib honours the HOME environmental variable, could
> LUK> it not be used on windows system as well?
> 
> Could you provide the context for your question? What are you trying
> to do and what isn't working?
> 
> JDH
> 
Hello John,
I'm sorry I was in a hurry to go home and tried to read my mail before 
that. I did not make myself clear. I just clicked on the link in the 
message to take a peek at the .matplotlibrc file and found that "On 
windows, this would be, for example, C:\Python23\share\matplotlib." That 
led me to wonder whether HOME will take effect in windows installation.
I had not updated matplotlib for a while and I know it has seen big 
improvements. I've now downloaded version 0.52 and I can see now when 
HOME is set, matplotlib will first read the config file there.
Perhaps the comments in the original .matplotlibrc can be altered to 
make this clear. It's a really a very good idea to be able to set 
everything using just one config file.
I'm sure the people on the list will agree that matplotlib is a great 
piece of work and you have been wonderful in answering questions.
Good day,
ST
--
From: Greg W. <gr...@th...> - 2004年03月31日 02:11:33
As a temporary solution you might try just transforming your r,theta
data to x, y and then drawing a grid over it.
I looked at the classes and with the loglog already done as an example,
it shouldn't be too hard to add polar plotting. So far though I haven't
got any further than printing out some of the code.
Here's a very rough example of a workaround.
#!/usr/bin/python
from Numeric import *
from matplotlib.matlab import *
 
def drawgrid(sp,rticlevels,thetaticlevels):
 for r in rticlevels:
 theta = arange(0,2*pi+0.05,0.05)
 x = r*cos(theta)
 y = r*sin(theta)
 sp.plot(x,y,'k-')
 for theta in thetaticlevels:
 x = rticlevels[-1]*cos(theta)
 y = rticlevels[-1]*sin(theta)
 sp.plot([0,x],[0,y],'k-')
 
def polar(sp,r,theta,marker,rticlevels,thetaticlevels):
 x = r*cos(theta)
 y = r*sin(theta)
 sp.plot(x,y,marker)
 drawgrid(sp,rticlevels,thetaticlevels)
 return sp
 
sp = subplot(111)
theta = arange(0,pi,0.1)
r = 0.5 + cos(theta)
polar(sp,r,theta,'b-',arange(0.5,2.0,0.5),arange(0.,2*pi,pi/9.))
On Tue, 2004年03月30日 at 14:32, Peter Groszkowski wrote:
> Hello:
> 
> I am currently using matplotlib for all the plotting in the software I am writing. I will however need to produce polar plots. As John has mentioned they should be added at one point. So my shameless question is roughly what version could I expect them to be included in? My options are to either wait for it, write it on my own, or write a simple interface (for my code) to GNUPlot or some other tool. I have not done very much poking around in the current matplotlib libraries (other than changing some rather minor details) and have a feeling that this might take me the longest. Interfacing GNUPLot to my code would not take more than a few hours, but I would prefer to stay with matplotlib. 
> 
> Thanks for the great work.
> Best,

Showing 5 results of 5

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 によって変換されたページ (->オリジナル) /