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






Showing 5 results of 5

From: Eric F. <ef...@ha...> - 2006年12月08日 18:26:45
Yannick Copin wrote:
> Hi,
> 
> in a case similar to matplotlib-0.87.7/examples/contour_demo.py (figure 
> 4), would it be possible to merge to two colorbars (a continuous one 
> from imshow, a discrete one from contour) into a single colorbar? 
> Indeed, in that case, the two colorbars are mostly redundant.
> 
> Cheers.
Yes, lines can be superimposed on a continuous colorbar. The demo is 
not ideal; I was mainly showing that one could use two colorbars for two 
different things. I have changed the contourf_demo.py in svn to include 
an example of a merged colorbar. Maybe I will change contour_demo.py 
later to make it an illustration of having colorbars for completely 
different fields, so it won't look so pointless as it does now.
Eric
From: Eric F. <ef...@ha...> - 2006年12月08日 18:08:50
Yannick Copin wrote:
> Hi,
> 
> running the simple test code:
> 
> from pylab import *
> X, Y = meshgrid(linspace(-3,3,11),linspace(-3,3,11))
> Z = randn(*X.shape)
> lev = linspace(Z.min(),Z.max(),11)[1:-1]
> contourf(X,Y,Z, lev, extend='both')
> contour(X,Y,Z, lev, colors='k')
> show()
> 
> you will probably notice that the 'contourf' contours are not always 
> exactly the sames as the 'contour' contours. Why is it so? Don't contour 
> and contourf use the same contour constructor?
The same overall routine is used for contour as for contourf, but the 
contour tracing operation is not identical. Tracing a filled contour is 
much more complicated--that is probably why it is so hard to find filled 
contour routines. I suspect that whoever wrote the original code we are 
using wrote the line contour version first, then had to add quite a bit 
of logic and code to get it to make filled contours.
Now, you may be wondering why we can't simply use the boundary of the 
filled regions for the lines as well, to guarantee they are the same. 
The reason is that filled contour boundaries include cuts connecting 
inner and outer contours, and also inner boundaries (edges of masked 
regions--except when affected by a bug) and the outer boundaries of the 
domain). It might be possible to simply exclude those line segments 
from the line contours, but it is not clear to me that the effort would 
be well-spent.
I think that the differences illustrated in your example will occur 
almost entirely in pathologically ambiguous cases, but it is also 
possible that they reflect actual bugs or shortcomings of the algorithms 
used. Understanding the logic and tracing the code path in the present 
cntr.c is difficult; I have tried but failed to figure out and correct 
the interior masked region bug in contourf. If a better core contour 
routine with a suitable license could be found and substituted for the 
present one, that would be very nice. I have searched many times 
without turning anything up.
Eric
From: Dave <da...@gm...> - 2006年12月08日 16:31:14
In past work I have not been able to get clipping to behave as I expected.
Today I was trying to understand how to add a right-axis label and was using
an example from the matplotlib site that set clip_on=False. It did not
work. In looking at the code in method text() it appears that it checks for
the existance of clip_on and not the value. So clip_on=False results in
clipping but not specifying clip_on does not. Is this understanding correct
and is it the intended behavior? If so, I can't see how the example could
have worked.
Also is there a standard, easy way to get a 2nd (right) axis label and ticks
or does it have to be done manually? I found only the one example on the
screenshots page where it is done with several text() method calls.
-- David
From: John H. <jdh...@ac...> - 2006年12月08日 15:33:26
>>>>> "Martin" == Martin Richter <law...@gm...> writes:
 Martin> My question now is: Is there a way to avoid using global
 Martin> variables but also avoid an object-oriented programming?
 Martin> In other words: Is it possible to pass e.g. a dictionary
 Martin> containing some information to the function called by the
 Martin> event? The reason for not wanting the object-oriented way
 Martin> is: We want to teach something to students who never
 Martin> programmed before. And to them it would be pretty hard if
 Martin> we start everything object-oriented!
The can use attrs on the function
def two_parts(event):
 if event.button == 3:
 two_parts.program_part = two_parts.program_part%2 + 1
 print " Changed to part to ", program_part
 if two_parts.program_part == 1 and event.button == 1:
 plot([event.xdata], [event.ydata], marker = 'o', mfc = 'r')
 if two_parts.program_part == 2 and event.button == 1:
 plot([event.xdata], [event.ydata], marker = 's', mfc = 'g')
 draw()
two_parts.program_part = 1
which would introduce them to attributes and pave the way to thinking
about OO.
JDH
From: Martin R. <law...@gm...> - 2006年12月08日 14:39:24
Hello everyone,
below is a little code - what it actually does is quite self-explanatory.
(When clicking with left - draw a red circle. When the right button is pressed 
switch to a different mode. Now green squares are drawn and so on.)
My question now is: Is there a way to avoid using global variables but also 
avoid an object-oriented programming? In other words: Is it possible to pass 
e.g. a dictionary containing some information to the function called by the 
event? The reason for not wanting the object-oriented way is: We want to 
teach something to students who never programmed before. And to them it would 
be pretty hard if we start everything object-oriented!
Thanks for your suggestions,
Martin
########################################
from pylab import *
def two_parts(event):
 global program_part
 if event.button == 3:
 program_part = program_part%2 + 1
 print " Changed to part to ", program_part
 if program_part == 1 and event.button == 1:
 plot([event.xdata], [event.ydata], marker = 'o', mfc = 'r')
 if program_part == 2 and event.button == 1:
 plot([event.xdata], [event.ydata], marker = 's', mfc = 'g')
 draw()
figure(1)
ax = subplot(111, autoscale_on=False)
ax.set_xlim([0,1])
ax.set_ylim([0,1])
program_part = 1
print " Actual program part is ", program_part
connect('button_press_event', two_parts)
show()
########################################
2 messages has been excluded from this view by a project administrator.

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