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
(14)
2
(22)
3
(8)
4
(10)
5
(1)
6
7
(11)
8
(4)
9
(14)
10
(18)
11
(18)
12
(2)
13
(8)
14
(14)
15
(6)
16
(8)
17
(9)
18
(9)
19
(7)
20
(8)
21
(8)
22
(14)
23
(10)
24
(11)
25
(17)
26
(1)
27
(3)
28
(12)





Showing 8 results of 8

From: Stephen W. <ste...@cs...> - 2005年02月21日 22:07:34
Eric Firing wrote:
> Are you suggesting something like this? Let each plotting function 
> have a new kwarg, perhaps called "validmask", with the same dimensions 
> as the dependent variable to be plotted, and with nonzero where the 
> variable is valid and 0 where it is missing.
More or less, except that the mask is an attribute (?) of a MaskedArray 
object. I for one would be in favor of this capability.
From: Eric F. <ef...@ha...> - 2005年02月21日 22:02:38
Perry,
>> I would like to phase in matplotlib to replace Matlab ASAP for 
>> plotting physical oceanographic observations, primarily current 
>> profile measurements. I (and many other physical oceanographers) 
>> primarily use contourf to plot filled contours; I only rarely use line 
>> contours. It looks to me like gcntr.c has the necessary 
>> functionality--the ability to output polygons enclosing regions 
>> between a pair of specified levels. Is someone already working on 
>> exposing that functionality in matplotlib, or is it planned?
>>
> No one (as far as I know :-) is working on it right now. It is in our 
> plans to add this capability. As you correctly note, the underlying C 
> code can handle this capability. I'm not sure how long it will be; right 
> now the priority is to finish contour labeling capability, and the 
> person working on that also has other work that competes with her time 
> to do this. I'm guessing that she could start looking at it in a couple 
> weeks. Of course, if someone wants to help now, that would be great.
I have started working on it. I don't know how far I will get; the 
necessary change to the c extension code was easy, but my first attempt 
to make a PolyCollection work in place of a Line Collection is failing. 
 I will do a bit more research before asking for help, if necessary. 
(No promises--I don't have much time to work on this, and it is my first 
plunge into the innards of matplotlib.)
> 
>> It appears that gcntr.c also has the ability to handle missing data 
>> via setting elements of the reg array to zero, and that this could be 
>> exposed fairly easily in the contour method in axes.py by adding "reg" 
>> to the set of kwargs. Correct? If so, is this also planned?
>>
> Correct. Yes (it is planned).
> 
>> The question of missing data handling in contour plotting brings up 
>> the more general issue of how to handle data gaps in plots. For 
>> example, the ocean current profiles that I measure using a Doppler 
>> profiler extend to varying depths, and sometimes have holes in the 
>> middle where there are not enough acoustic scatterers to give a 
>> signal. This sort of thing--data gaps--is universal in physical 
>> oceanography. One of Matlab's major strengths is the way it handles 
>> them, using nan as a bad value flag. Plotting a line with the plot 
>> command, the line is broken at each nan; so if there is a hole in the 
>> data, the plot shows exactly that. The same for contouring: nans are 
>> automatically used as a mask.
>>
>> Obviously, not everyone needs this kind of automatic handling of data 
>> gaps, but I think it would be very useful for many applications, so I 
>> hope it can be considered as a possible goal. At the plotting level, 
>> collections may make it easier to implement than would have been the 
>> case in the early days of matplotlib. At the array manipulation 
>> level, the implementation could involve either masked arrays or nans. 
>> I would greatly prefer the Matlab-style nan approach, but I don't know 
>> whether this would work with Numeric. Maybe in Numeric3? Numarray 
>> appears better equipped, with its ieeespecial.py module.
>>
> I think you touch on the key issue. I think we'd have to figure out how 
> to handle this between Numeric and numarray (and Numeric3 potentially). 
> Would a mask array be a suitable substitute as an interim solution?
Are you suggesting something like this? Let each plotting function have 
a new kwarg, perhaps called "validmask", with the same dimensions as the 
dependent variable to be plotted, and with nonzero where the variable is 
valid and 0 where it is missing. The mask would then be used (1) to 
limit the autoranging tests to the valid data, (2) in the case of line 
plotting, to break the line up into segments so that a LineCollection 
would be plotted, (3) in the case of contouring, to set the reg array, 
(4) for images or pcolors to similarly mask out the invalid regions with 
white, or transparent, or perhaps some settable color.
This could be implemented in matplotlib in a way that would not depend 
on any special features, or likely changes, in the 
Numeric/Numeric3/numarray set.
A numarray user could then use
def notnan(y):
 return numarray.ieeespecial.mask(y, numarray.ieeespecial.NAN)
and say
plot(x, y, validmask=notnan(y))
In any case, this "validmask kwarg" solution seems to me like a 
perfectly good one from a user's standpoint, and a good bridge to the 
happy day when Numeric/Numeric3/numarray converge or evolve to a single, 
dominant numerical module with good nan handling built in. (I very much 
hope such convergence will occur, and the sooner the better.)
Eric
From: Perry G. <pe...@st...> - 2005年02月21日 17:07:39
On Feb 19, 2005, at 9:23 PM, Eric Firing wrote:
> John et al.,
>
> I would like to phase in matplotlib to replace Matlab ASAP for 
> plotting physical oceanographic observations, primarily current 
> profile measurements. I (and many other physical oceanographers) 
> primarily use contourf to plot filled contours; I only rarely use line 
> contours. It looks to me like gcntr.c has the necessary 
> functionality--the ability to output polygons enclosing regions 
> between a pair of specified levels. Is someone already working on 
> exposing that functionality in matplotlib, or is it planned?
>
No one (as far as I know :-) is working on it right now. It is in our 
plans to add this capability. As you correctly note, the underlying C 
code can handle this capability. I'm not sure how long it will be; 
right now the priority is to finish contour labeling capability, and 
the person working on that also has other work that competes with her 
time to do this. I'm guessing that she could start looking at it in a 
couple weeks. Of course, if someone wants to help now, that would be 
great.
> It appears that gcntr.c also has the ability to handle missing data 
> via setting elements of the reg array to zero, and that this could be 
> exposed fairly easily in the contour method in axes.py by adding "reg" 
> to the set of kwargs. Correct? If so, is this also planned?
>
Correct. Yes (it is planned).
> The question of missing data handling in contour plotting brings up 
> the more general issue of how to handle data gaps in plots. For 
> example, the ocean current profiles that I measure using a Doppler 
> profiler extend to varying depths, and sometimes have holes in the 
> middle where there are not enough acoustic scatterers to give a 
> signal. This sort of thing--data gaps--is universal in physical 
> oceanography. One of Matlab's major strengths is the way it handles 
> them, using nan as a bad value flag. Plotting a line with the plot 
> command, the line is broken at each nan; so if there is a hole in the 
> data, the plot shows exactly that. The same for contouring: nans are 
> automatically used as a mask.
>
> Obviously, not everyone needs this kind of automatic handling of data 
> gaps, but I think it would be very useful for many applications, so I 
> hope it can be considered as a possible goal. At the plotting level, 
> collections may make it easier to implement than would have been the 
> case in the early days of matplotlib. At the array manipulation 
> level, the implementation could involve either masked arrays or nans. 
> I would greatly prefer the Matlab-style nan approach, but I don't know 
> whether this would work with Numeric. Maybe in Numeric3? Numarray 
> appears better equipped, with its ieeespecial.py module.
>
I think you touch on the key issue. I think we'd have to figure out how 
to handle this between Numeric and numarray (and Numeric3 potentially). 
Would a mask array be a suitable substitute as an interim solution?
Perry
From: John H. <jdh...@ac...> - 2005年02月21日 17:00:45
>>>>> "James" == James Boyle <bo...@ll...> writes:
 James> From what I can gather, I can change the line colors and
 James> widths in the contour routine but cannot specify a line
 James> style such as dashed, dotted etc.
 James> Is this true? If so I would like to have this capability -
 James> it makes black and white plots easier to interpret.
There was a bug in the drawing routing for agg line collections that
was preventing us from using this. I fixed it this morning. The new
default is to use dashed lines for contour levels <0.
The contour routine returns (levels, collections) where collections is
a list of LineCollection instances, one for each level. You can now
use the collection.set_linestyle method, which *should* work across
backends. Valid args are
'solid' | 'dashed', 'dashdot', 'dotted' | (offset, on-off-dash-seq)
where the last option allows you to control the dash sequence
explicitly; on-off-dash-seq is an even length sequence of on/off ink
in points. Eg, you can do 
 dashes = 0, (5,1,10,3) 
 collection.set_linestyle(dashes)
which is 5 points on, 1 off, followed by 10 points on, 3 off and then
repeated.
 James> In any case the contour in 0.72 works great - thanks
Glad to hear it -- we'll be adding more features (eg auto-labeling,
poly filling) as we get time. 
The linestyle support is in 0.72.1, which I uploaded to the sf site
this morning.
JDH
From: John H. <jdh...@ac...> - 2005年02月21日 14:34:27
>>>>> "Darren" == Darren Dale <dd...@co...> writes:
 Darren> Wow, I was going crazy trying to reproduce this. Your
 Darren> script works fine. Try this one:
 ....
 Darren> Both the x *and* y axes have to be set_visible(False) to
 Darren> reproduce the behavior.
OK, that helps. Thanks.
The problem can be fixed in backend_ps RendererPS.set_color, change
the line
 self.color = (r,g,b)
to 
 if store: self.color = (r,g,b)
Thanks for the report and example.
JDH
From: fabian s. <fs...@ce...> - 2005年02月21日 07:40:50
I develop a web application under zope and I would like installing 
matplotlib under zope.Considering that the python of zope has no the 
entry in the register, how installing matplotlib?
thanks
From: Darren D. <dd...@co...> - 2005年02月21日 02:59:45
Wow, I was going crazy trying to reproduce this. Your script works fine. Try 
this one:
from pylab import *
a=rand(100,100)
ax=axes()
ax.imshow(a)
ax.xaxis.set_visible(False)
ax.yaxis.set_visible(False)
ax.text(10,10,'white',color='w')
ax.text(10,20,'black',color='k')
savefig('temp.ps')
Both the x *and* y axes have to be set_visible(False) to reproduce the 
behavior.
Darren
On Sunday 20 February 2005 07:47 pm, John Hunter wrote:
> >>>>> "Darren" == Darren Dale <dd...@co...> writes:
>
> Darren> I am displaying some images and overlaying a scalebar. The
> Darren> image on the screen displays the requested white text and
> Darren> bar, but they are black in the eps image.
>
> Hi Darren,
>
> I'm having trouble replicating the problem. Make sure you have an
> up-to-date matplotlib. For example, in CVS, I get the expected
> behavior in agg and ps with
>
> from pylab import *
> subplot(111, axisbg='red')
> text(0.5, 3.5,'this is black', color=0)
> text(0.5, 2.5,'this is black', color='k')
> text(0.5, 1.5,'this is white', color=1)
> text(0.5, 0.5,'this is white', color='w')
> axis([0,2,0,4])
> savefig('test.ps')
> show()
>
> If you are still having troubles, please submit a complete test
> script, and the output of --verbose-helpful when you run it.
>
> Is it possible you have a pre 0.72 CVS? There were a couple of bugs I
> introduced into PS CVS before the last release, but I think I cleaned
> them up.
>
> Hope this helps,
> JDH
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-- 
Darren
From: John H. <jdh...@ac...> - 2005年02月21日 00:58:36
>>>>> "Darren" == Darren Dale <dd...@co...> writes:
 Darren> I am displaying some images and overlaying a scalebar. The
 Darren> image on the screen displays the requested white text and
 Darren> bar, but they are black in the eps image.
Hi Darren,
I'm having trouble replicating the problem. Make sure you have an
up-to-date matplotlib. For example, in CVS, I get the expected
behavior in agg and ps with
 from pylab import *
 subplot(111, axisbg='red')
 text(0.5, 3.5,'this is black', color=0) 
 text(0.5, 2.5,'this is black', color='k')
 text(0.5, 1.5,'this is white', color=1) 
 text(0.5, 0.5,'this is white', color='w')
 axis([0,2,0,4])
 savefig('test.ps')
 show()
If you are still having troubles, please submit a complete test
script, and the output of --verbose-helpful when you run it.
Is it possible you have a pre 0.72 CVS? There were a couple of bugs I
introduced into PS CVS before the last release, but I think I cleaned
them up.
Hope this helps,
JDH

Showing 8 results of 8

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