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

Showing 19 results of 19

From: Eric F. <ef...@ha...> - 2011年12月13日 22:39:46
On 12/13/2011 11:03 AM, Nico Schlömer wrote:
> Hi all,
>
> when drawing contourf plots, I inspected the underlying
> matplotlib.path.Path elements that determine the curves and noticed
> that they are all of code LINETO (see
> http://matplotlib.sourceforge.net/api/path_api.html#matplotlib.path.Path)
> although the number of vertices is 6, actually suggesting a CURVE4.
>
> Would that be a bug?
I don't see it.
x = np.arange(9)
x.shape = (3,3)
cs = contourf(x, 1)
print cs.collections.get_paths()
This shows a set of vertices with a matching set of LINETO (after an 
initial MOVETO). contour and contourf generate piece-wise linear paths 
with vertices on grid cell boundaries; they make no attempt to smooth 
out the contours.
Eric
>
> Cheers,
> Nico
From: Benjamin R. <ben...@ou...> - 2011年12月13日 22:30:47
On Tue, Dec 13, 2011 at 3:55 PM, Nico Schlömer <nic...@gm...>wrote:
> > "RGB and RGBA are sequences of, respectively, 3 or 4 floats in the range
> 0-1."
>
> That would explain it. It also seems that I never ever will have to
> worry about CMYK values as they don't seem to be used anywhere in
> matplotlib as a search on the website for "cmyk" suggests.
>
> --Nico
>
>
Correct. Matplotlib currently does not support CMYK representation. The
fourth element is the alpha (transparency) value.
Ben Root
From: Nico S. <nic...@gm...> - 2011年12月13日 21:56:15
> "RGB and RGBA are sequences of, respectively, 3 or 4 floats in the range 0-1."
That would explain it. It also seems that I never ever will have to
worry about CMYK values as they don't seem to be used anywhere in
matplotlib as a search on the website for "cmyk" suggests.
--Nico
On Tue, Dec 13, 2011 at 10:19 PM, Vlastimil Brom
<vla...@gm...> wrote:
> 2011年12月13日 Nico Schlömer <nic...@gm...>:
>> Hi,
>>
>> upon extracting the face color of a matplotlib.path.Path object,
>>
>>  fc = obj.get_facecolor()
>>
>> I always seem to get an array of length 4. This initially led me to
>> believe I'm dealing with CMYK values, but it really seems like the
>> last entry is *always* 1.0 and the first three give the RGB
>> representation of the respective color.
>> Is there any documentation on color codes usage in matplotlib?
>>
>> Cheers,
>> Nico
>>...
>
> Hi,
> maybe:
> http://matplotlib.sourceforge.net/api/colors_api.html#module-matplotlib.colors
>
> "RGB and RGBA are sequences of, respectively, 3 or 4 floats in the range 0-1."
>
> hth,
> vbr
>
> ------------------------------------------------------------------------------
> Systems Optimization Self Assessment
> Improve efficiency and utilization of IT resources. Drive out cost and
> improve service delivery. Take 5 minutes to use this Systems Optimization
> Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Vlastimil B. <vla...@gm...> - 2011年12月13日 21:19:53
2011年12月13日 Nico Schlömer <nic...@gm...>:
> Hi,
>
> upon extracting the face color of a matplotlib.path.Path object,
>
>  fc = obj.get_facecolor()
>
> I always seem to get an array of length 4. This initially led me to
> believe I'm dealing with CMYK values, but it really seems like the
> last entry is *always* 1.0 and the first three give the RGB
> representation of the respective color.
> Is there any documentation on color codes usage in matplotlib?
>
> Cheers,
> Nico
>...
Hi,
maybe:
http://matplotlib.sourceforge.net/api/colors_api.html#module-matplotlib.colors
"RGB and RGBA are sequences of, respectively, 3 or 4 floats in the range 0-1."
hth,
 vbr
From: Nico S. <nic...@gm...> - 2011年12月13日 21:07:04
Hi,
upon extracting the face color of a matplotlib.path.Path object,
 fc = obj.get_facecolor()
I always seem to get an array of length 4. This initially led me to
believe I'm dealing with CMYK values, but it really seems like the
last entry is *always* 1.0 and the first three give the RGB
representation of the respective color.
Is there any documentation on color codes usage in matplotlib?
Cheers,
Nico
From: Nico S. <nic...@gm...> - 2011年12月13日 21:03:53
Hi all,
when drawing contourf plots, I inspected the underlying
matplotlib.path.Path elements that determine the curves and noticed
that they are all of code LINETO (see
http://matplotlib.sourceforge.net/api/path_api.html#matplotlib.path.Path)
although the number of vertices is 6, actually suggesting a CURVE4.
Would that be a bug?
Cheers,
Nico
From: Martella, C. <cla...@vu...> - 2011年12月13日 19:52:55
Hello,
I have 2D array where each (x, y) cell represents the height of that point on the Z axis (you can think of it as the map of some mountain chain). 
I'd like to get the plot_surface() of this data. What I don't understand in particular is the content of the X, Y ,Z array parameter in my particular example.
Can anybody elaborate on this please?
Thanks!
Claudio
--
 Claudio Martella
 cla...@vu...
From: David H. <dh...@gm...> - 2011年12月13日 19:20:42
Yeah I didn't think about suggesting that, but I think it might get 
complicated. I think he would have to start a one shot timer to call a 
function to set the voltage. Then that function would also start 
another one shot timer to call another function that would read from the 
sample. That function then would start a one shot timer to call the 
first function again. This way he can be sure that things are called in 
order and that timing is consistent, just in case the GUI gets 
complicated or something makes the event loop slow down.
He could also use multiple threads. Whatever works for Fabien I guess.
-Dave
On 12/13/11 1:00 PM, mat...@li... wrote:
> From: "Drain, Theodore R (343P)"<the...@jp...>
> Subject: Re: [Matplotlib-users] [ploting data] Live data
>
> Perhaps I'm missing something, but why not use QTimer? You can't really every call sleep in a single threaded gui (for reasons you've encountered). If you need to poll something, create a QTimer for 2 seconds and have it call a measurement function to update the data. You shouldn't need any processEvents calls or sleep.
From: Alex N. <yeo...@gm...> - 2011年12月13日 19:12:50
On Mon, Dec 12, 2011 at 7:03 PM, Benjamin Root <ben...@ou...> wrote:
> On Sat, Dec 10, 2011 at 10:36 AM, Alex Naysmith <yeo...@gm...>wrote:
>
>> Hello,
>>
>> I'm trying to plot the stresses in colour of a strained isoparametric
>> element.
>>
>> I have a six noded triangle with vertice coordinates
>> [(xa1,ya1),(xa2,ya2),(xa3,ya3)] = pos_a
>>
>> This triangle deforms and the new coordinate positions are
>> [(xb1,yb1),(xa2,yb2),(xb3,yb3)] = pos_b
>>
>> The remaining nodes are mid nodes also with rest and deformed coordinate
>> positions.
>>
>> To plot the edges of the triangle I use a Jacobian transformation
>> function so that the coordinates of the triangle are in Jacobian
>> coordinates xi1 and xi2 (with xi3 = 1 - xi1 - xi2). This is required as the
>> elements are quadratic with mid-nodes.
>>
>> Each interval is hard coded so that:
>> xi1 = [1.0,0.9,0.8,0.7,0.6,0.5, etc..]
>> xi2 = [0.0,0.1,0.2,0.3,0.4,0.5, etc..]
>>
>> I would like to plot the strains in colour so that the interior of the
>> triangle is filled but I don't want to hard code the Jacobian intervals as
>> this seems an awkward way of doing it.
>>
>> With strain as a function of xi1 and xi2, How can matplotlib provide a
>> continuous interior strain plot of the triangle for all the xi1 and xi2
>> values from 0 to 1?
>>
>> Regards
>>
>> Alex Naysmith
>>
>>
> Alex,
>
> Perhaps if you can provide an example figure, we might be able to better
> help you. Right now, I am having trouble envisioning what you describe.
>
> Ben Root
>
> Ben,
I have created a script that uses one isoparametric triangle as an example.
The triangle nodes undergo a displacement, resulting in strains inside the
triangle. The new script calculates the strains inside the triangle for a
range of xi1 and xi2 barycentric coordinates and returns the global
coordinates with the corresponding strain.
I would like matplotlib to give me a nice interpolated colour plot of the
strains inside the triangle, but as the output global coordinates are not
aligned in neat rows and columns, I cannot do a straightforward meshgrid
plot with imshow.
http://bazaar.launchpad.net/~eckeroo/misc/mpl_scripts/files
There are further comments in the script that may explain things better.
I want a figure like this:
http://matplotlib.sourceforge.net/examples/pylab_examples/animation_demo.html
But for a 6 noded quadratic triangle instead of square. The intention is to
have all the triangles in the mesh display their strains with interpolated
colours.
Regards
Alex
From: Martella, C. <c.m...@vu...> - 2011年12月13日 19:12:28
Hello,
I have 2D array where each (x, y) cell represents the height of that point on the Z axis (you can think of it as the map of some mountain chain). 
I'd like to get the plot_surface() of this data. What I don't understand in particular is the content of the X, Y ,Z array parameter in my particular example.
Can anybody elaborate on this please?
Thanks!
Claudio
--
 Claudio Martella
 cla...@vu...
From: Drain, T. R (343P) <the...@jp...> - 2011年12月13日 19:00:41
Perhaps I'm missing something, but why not use QTimer? You can't really every call sleep in a single threaded gui (for reasons you've encountered). If you need to poll something, create a QTimer for 2 seconds and have it call a measurement function to update the data. You shouldn't need any processEvents calls or sleep.
________________________________________
From: Fabien Lafont [laf...@gm...]
Sent: Tuesday, December 13, 2011 12:30 AM
To: David Hoese
Cc: mat...@li...
Subject: Re: [Matplotlib-users] [ploting data] Live data
Hey David,
I'm doing this program to control an experiment, so I want to put the
voltage on the sample, then wait two seconds to be sure there is no
current fluctuations then measure the curent with multimeters and
finally plot the datas. That's why I need the "sleep"... In fact I
wanted to use in parallel the timer to "refresh" the graph and a while
loop to "extract" the datas.
If I use startTimer(0) it works but the GUI is almost unresponsive.
I'm trying to use qApp.processEvents() but up to now I don't manage to
see the window appears...
Thanks again for your help
Fabien
2011年12月12日 David Hoese <dh...@gm...>:
> Hey Fabien,
>
> So you made your principal function run on a timer every 2 seconds? And by
> "lag" do you mean that the GUI is unresponsive? I'm still not seeing when
> the loop stops, but what you can do is set the timer at a 0 interval so it
> will call the principal function as fast as it can (but with no loop). The
> problem with this is that you have those 2 sleep calls in the function. I'm
> not sure why you have the sleeps, but if you need them you have two choices:
>
> 1. Make you GUI multi-threaded and you could emit a Qt signal from the data
> thread when the GUI thread needs to update the GUI. Yes this could get
> complicated, but if the sleeps are required then its probably the best way.
>
> 2. (From what I've been told, the Qt experts don't approve this) You can use
> app.processEvents() in your loop (after each sleep maybe) and this will
> pause your function and tell the main event loop to process any queued
> events (like GUI actions/events) which will make your GUI more responsive.
>
> If that doesn't make sense let me know.
>
> -Dave
>
>
> On 12/12/11 9:16 AM, Fabien Lafont wrote:
>>
>> Hi David! Sorry about the delay I was abroad and without any way to
>> connect to the internet.
>>
>> Thank you very much. I've tried to put the principal inside the
>> timerEvent. It work but it lags. In fact I've set the interval of the
>> Timer to 2 seconds because the principal loop takes roughly 2seconds
>> but it's not very accurate...
>>
>> Is there a way to do the principal loop, show it on the screen, then
>> redo the loop?
>>
>> Thanks again!
>>
>> Fabien
>>
>> 2011年12月5日 David Hoese<dh...@gm...>:
>>>
>>> If I'm understanding your question correctly and reading your code
>>> correctly, you're asking why the timer method of doing things works, but the
>>> principal() while loop method does not.
>>>
>>> I had a couple solutions that involved the main event loop, but I just
>>> noticed 2 main things that are probably wrong with your code:
>>> 1. You are calling 'principal' from inside __init__ so you never actually
>>> return from __init__ which means that you never call "window.show()" and
>>> therefore never call "qApp.exec_()". If you really want to use the
>>> 'principal' method you would have to connect it to a one shot timer anyway
>>> to have it run after you have started the application ('qApp.exec_()'). I
>>> think the recommended way would be to use the timer the way you did in your
>>> latest email.
>>>
>>> 2. At least in the way my email client reads your original code, your
>>> calls to the matplotlib drawing functions aren't inside the while loop and
>>> the while loop never ends...although this doesn't matter if you don't fix #1
>>> above.
>>>
>>> Hope that made sense.
>>>
>>> -Dave
>>>
>>>
>>> On 12/5/11 1:44 PM, mat...@li... wrote:
>>>>
>>>> Message: 3
>>>> Date: Mon, 5 Dec 2011 15:46:02 +0100
>>>> From: Fabien Lafont<laf...@gm...>
>>>> Subject: Re: [Matplotlib-users] [ploting data] Live data
>>>> Cc:mat...@li...
>>>> Message-ID:
>>>>
>>>> <CAC9H_cjrgQBE6e6+jzZHyfYHonTeAg0XwU7c_2G-hu=s+...@ma...>
>>>> Content-Type: text/plain; charset=ISO-8859-1
>>>>
>>>> Thx all for your remarks,
>>>>
>>>> I can't understand why this code works (when I use the timer method):
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> All the data continuously generated in your IT infrastructure
>>> contains a definitive record of customers, application performance,
>>> security threats, fraudulent activity, and more. Splunk takes this
>>> data and makes sense of it. IT sense. And common sense.
>>> http://p.sf.net/sfu/splunk-novd2d
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
------------------------------------------------------------------------------
Systems Optimization Self Assessment
Improve efficiency and utilization of IT resources. Drive out cost and
improve service delivery. Take 5 minutes to use this Systems Optimization
Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Jérôme <je...@jo...> - 2011年12月13日 18:43:37
Hi all.
I'm trying to use plot_date and I get an error I don't understand.
I've reduced my problem to this small example:
-----------------------------------------------------------------
from pylab import figure, show
dates = [301,302,303]
#dates = [1,2,303]
#dates = [1,2,3]
values = [1,2,4]
fig = figure()
ax = fig.add_subplot(111)
ax.plot_date(dates, values,'-')
fig.autofmt_xdate()
show()
-----------------------------------------------------------------
This works. I get a plot with the values for the 301st, 302nd and 303rd day
of year one. (I don't actually mind the year, all I know is my simulation
starts the first of january of any year.)
If I use dates = [1,2,303], it works as well.
However, with dates = [1,2,3], it does not, and I get the error :
OverflowError: date value out of range
I don't understand. I may not be aware of everything concerning dates in
python, but as far as I understand, those dates are correct and are the
first three days of year one. Aren't they ?
Since I don't mind the year, I guess I could add an arbitrary number of years
to my dates as a workaround for this error.
Another question that could be related:
http://www.mail-archive.com/mat...@li.../msg01720.html
Thanks for any help.
-- 
Jérôme
From: Hongchun J. <hon...@gm...> - 2011年12月13日 18:24:19
*Hi folks, *
*
*
*I try to use the PDF backend in my plotting script, when I expect to have
a pdf figure. However, when I open the figure in Adobe Illustrator, it
turns out that the fonts are not "real fonts". I mean I want to be able to
directly edit them. For example, when I double click the fonts or use other
ways, I want to edit the fonts without deleting them and replacing with new
ones. Am I missing something or not doing it correctly? *
*
*
*Sample: *
*
# use PDF backends
import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
..........
fig = plt.figure()
..........
fig.savefig('sample.pdf')
**Best,
Hongchun
*
On Mon, Dec 12, 2011 at 7:05 PM, C Barrington-Leigh <cpb...@gm...>wrote:
> Oops; I just posted this to comp.lang.python, but I wonder whether
> matplotlib questions are supposed to go to scipy-user?
How about mat...@li...? I've cc'ed to that list.
Warren
> Here it is:
> """
> Before I upgraded to 2.7.2+ / 4 OCt 2011, the following code added a
> comment line to an axis legend using matplotlib / pylab.
> Now, the same code makes the legend appear "off-screen", ie way
> outside the axes limits.
>
> Can anyone help? And/or is there a new way to add a title and footer
> to the legend?
>
> Thanks!
> """
>
> from pylab import *
> plot([0,0],[1,1],label='Ubuntu 11.10')
> lh=legend(fancybox=True,shadow=False)
> lh.get_frame().set_alpha(0.5)
>
> from matplotlib.offsetbox import TextArea, VPacker
> fontsize=lh.get_texts()[0].get_fontsize()
> legendcomment=TextArea('extra comments here',
> textprops=dict(size=fontsize))
> show()
> # Looks fine here
> lh._legend_box = VPacker(pad=5,
> sep=0,
> children=[lh._legend_box,legendcomment],
> align="left")
> lh._legend_box.set_figure(gcf())
> draw()
>
>
> _______________________________________________
> SciPy-User mailing list
> Sci...@sc...
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
From: David H. <dh...@gm...> - 2011年12月13日 14:43:35
Fabien,
The GUI not being responsive might be my fault, I've never used a timer 
of 0 and processEvents(). I think what might be happening is that when
you call processEvents, the timer of 0 calls your principal function 
again, which calls processEvents again, and so on. Try a timer of 2 
again, that "should" stop the timer from being constantly triggered. 
Later today, once I get to work, I'll run some tests of my own and 
figure out if that's really the problem. Email me if you make any progress.
-Dave
On 12/13/2011 2:30 AM, Fabien Lafont wrote:
> Hey David,
>
> I'm doing this program to control an experiment, so I want to put the
> voltage on the sample, then wait two seconds to be sure there is no
> current fluctuations then measure the curent with multimeters and
> finally plot the datas. That's why I need the "sleep"... In fact I
> wanted to use in parallel the timer to "refresh" the graph and a while
> loop to "extract" the datas.
>
> If I use startTimer(0) it works but the GUI is almost unresponsive.
> I'm trying to use qApp.processEvents() but up to now I don't manage to
> see the window appears...
>
> Thanks again for your help
>
> Fabien
>
>
>
> 2011年12月12日 David Hoese<dh...@gm...>:
>> Hey Fabien,
>>
>> So you made your principal function run on a timer every 2 seconds? And by
>> "lag" do you mean that the GUI is unresponsive? I'm still not seeing when
>> the loop stops, but what you can do is set the timer at a 0 interval so it
>> will call the principal function as fast as it can (but with no loop). The
>> problem with this is that you have those 2 sleep calls in the function. I'm
>> not sure why you have the sleeps, but if you need them you have two choices:
>>
>> 1. Make you GUI multi-threaded and you could emit a Qt signal from the data
>> thread when the GUI thread needs to update the GUI. Yes this could get
>> complicated, but if the sleeps are required then its probably the best way.
>>
>> 2. (From what I've been told, the Qt experts don't approve this) You can use
>> app.processEvents() in your loop (after each sleep maybe) and this will
>> pause your function and tell the main event loop to process any queued
>> events (like GUI actions/events) which will make your GUI more responsive.
>>
>> If that doesn't make sense let me know.
>>
>> -Dave
>>
>>
>> On 12/12/11 9:16 AM, Fabien Lafont wrote:
>>>
>>> Hi David! Sorry about the delay I was abroad and without any way to
>>> connect to the internet.
>>>
>>> Thank you very much. I've tried to put the principal inside the
>>> timerEvent. It work but it lags. In fact I've set the interval of the
>>> Timer to 2 seconds because the principal loop takes roughly 2seconds
>>> but it's not very accurate...
>>>
>>> Is there a way to do the principal loop, show it on the screen, then
>>> redo the loop?
>>>
>>> Thanks again!
>>>
>>> Fabien
>>>
>>> 2011年12月5日 David Hoese<dh...@gm...>:
>>>>
>>>> If I'm understanding your question correctly and reading your code
>>>> correctly, you're asking why the timer method of doing things works, but the
>>>> principal() while loop method does not.
>>>>
>>>> I had a couple solutions that involved the main event loop, but I just
>>>> noticed 2 main things that are probably wrong with your code:
>>>> 1. You are calling 'principal' from inside __init__ so you never actually
>>>> return from __init__ which means that you never call "window.show()" and
>>>> therefore never call "qApp.exec_()". If you really want to use the
>>>> 'principal' method you would have to connect it to a one shot timer anyway
>>>> to have it run after you have started the application ('qApp.exec_()'). I
>>>> think the recommended way would be to use the timer the way you did in your
>>>> latest email.
>>>>
>>>> 2. At least in the way my email client reads your original code, your
>>>> calls to the matplotlib drawing functions aren't inside the while loop and
>>>> the while loop never ends...although this doesn't matter if you don't fix #1
>>>> above.
>>>>
>>>> Hope that made sense.
>>>>
>>>> -Dave
>>>>
>>>>
>>>> On 12/5/11 1:44 PM, mat...@li... wrote:
>>>>>
>>>>> Message: 3
>>>>> Date: Mon, 5 Dec 2011 15:46:02 +0100
>>>>> From: Fabien Lafont<laf...@gm...>
>>>>> Subject: Re: [Matplotlib-users] [ploting data] Live data
>>>>> Cc:mat...@li...
>>>>> Message-ID:
>>>>>
>>>>> <CAC9H_cjrgQBE6e6+jzZHyfYHonTeAg0XwU7c_2G-hu=s+...@ma...>
>>>>> Content-Type: text/plain; charset=ISO-8859-1
>>>>>
>>>>> Thx all for your remarks,
>>>>>
>>>>> I can't understand why this code works (when I use the timer method):
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> All the data continuously generated in your IT infrastructure
>>>> contains a definitive record of customers, application performance,
>>>> security threats, fraudulent activity, and more. Splunk takes this
>>>> data and makes sense of it. IT sense. And common sense.
>>>> http://p.sf.net/sfu/splunk-novd2d
>>>> _______________________________________________
>>>> Matplotlib-users mailing list
>>>> Mat...@li...
>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
From: Fabien L. <laf...@gm...> - 2011年12月13日 08:30:13
Hey David,
I'm doing this program to control an experiment, so I want to put the
voltage on the sample, then wait two seconds to be sure there is no
current fluctuations then measure the curent with multimeters and
finally plot the datas. That's why I need the "sleep"... In fact I
wanted to use in parallel the timer to "refresh" the graph and a while
loop to "extract" the datas.
If I use startTimer(0) it works but the GUI is almost unresponsive.
I'm trying to use qApp.processEvents() but up to now I don't manage to
see the window appears...
Thanks again for your help
Fabien
2011年12月12日 David Hoese <dh...@gm...>:
> Hey Fabien,
>
> So you made your principal function run on a timer every 2 seconds? And by
> "lag" do you mean that the GUI is unresponsive? I'm still not seeing when
> the loop stops, but what you can do is set the timer at a 0 interval so it
> will call the principal function as fast as it can (but with no loop). The
> problem with this is that you have those 2 sleep calls in the function. I'm
> not sure why you have the sleeps, but if you need them you have two choices:
>
> 1. Make you GUI multi-threaded and you could emit a Qt signal from the data
> thread when the GUI thread needs to update the GUI. Yes this could get
> complicated, but if the sleeps are required then its probably the best way.
>
> 2. (From what I've been told, the Qt experts don't approve this) You can use
> app.processEvents() in your loop (after each sleep maybe) and this will
> pause your function and tell the main event loop to process any queued
> events (like GUI actions/events) which will make your GUI more responsive.
>
> If that doesn't make sense let me know.
>
> -Dave
>
>
> On 12/12/11 9:16 AM, Fabien Lafont wrote:
>>
>> Hi David! Sorry about the delay I was abroad and without any way to
>> connect to the internet.
>>
>> Thank you very much. I've tried to put the principal inside the
>> timerEvent. It work but it lags. In fact I've set the interval of the
>> Timer to 2 seconds because the principal loop takes roughly 2seconds
>> but it's not very accurate...
>>
>> Is there a way to do the principal loop, show it on the screen, then
>> redo the loop?
>>
>> Thanks again!
>>
>> Fabien
>>
>> 2011年12月5日 David Hoese<dh...@gm...>:
>>>
>>> If I'm understanding your question correctly and reading your code
>>> correctly, you're asking why the timer method of doing things works, but the
>>> principal() while loop method does not.
>>>
>>> I had a couple solutions that involved the main event loop, but I just
>>> noticed 2 main things that are probably wrong with your code:
>>> 1. You are calling 'principal' from inside __init__ so you never actually
>>> return from __init__ which means that you never call "window.show()" and
>>> therefore never call "qApp.exec_()". If you really want to use the
>>> 'principal' method you would have to connect it to a one shot timer anyway
>>> to have it run after you have started the application ('qApp.exec_()'). I
>>> think the recommended way would be to use the timer the way you did in your
>>> latest email.
>>>
>>> 2. At least in the way my email client reads your original code, your
>>> calls to the matplotlib drawing functions aren't inside the while loop and
>>> the while loop never ends...although this doesn't matter if you don't fix #1
>>> above.
>>>
>>> Hope that made sense.
>>>
>>> -Dave
>>>
>>>
>>> On 12/5/11 1:44 PM, mat...@li... wrote:
>>>>
>>>> Message: 3
>>>> Date: Mon, 5 Dec 2011 15:46:02 +0100
>>>> From: Fabien Lafont<laf...@gm...>
>>>> Subject: Re: [Matplotlib-users] [ploting data] Live data
>>>> Cc:mat...@li...
>>>> Message-ID:
>>>>
>>>> <CAC9H_cjrgQBE6e6+jzZHyfYHonTeAg0XwU7c_2G-hu=s+...@ma...>
>>>> Content-Type: text/plain; charset=ISO-8859-1
>>>>
>>>> Thx all for your remarks,
>>>>
>>>> I can't understand why this code works (when I use the timer method):
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> All the data continuously generated in your IT infrastructure
>>> contains a definitive record of customers, application performance,
>>> security threats, fraudulent activity, and more. Splunk takes this
>>> data and makes sense of it. IT sense. And common sense.
>>> http://p.sf.net/sfu/splunk-novd2d
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Laat d. J. \(KNMI\) <jos...@kn...> - 2011年12月13日 08:04:40
# This is a piece of code that I actually used to try to solve the
problem
# Just assumed that I have an int32 array ("data") with satellite data
of dimensions [x,y,3] filled with RGB values ... I have removed the
reading of satellite sample data, which is not relevant here.
# The satellite (geostationary) is located above the equator at zero
degrees east
# in this example I want a plot with 300 dpi resolution.
import numpy
import matplotlib.pyplot as plt
dpi = 300
fig = plt.figure(figsize=[data.shape[0]/dpi,data.shape[1]/dpi])
ax = plt.axes([0,0,1,1], frameon = False)
ax.set_axis_off()
im = ax.imshow(data, origin='None')
from mpl_toolkits.basemap import Basemap
map = Basemap(projection='ortho', lat_0 = 0, lon_0 = 0,
	 resolution = 'l', area_thresh = 1000.)
map.drawcoastlines()
fig.savefig('figure.png', format='png', dpi=dpi)
-----Original Message-----
From: Patrick Marsh [mailto:pat...@gm...] 
Sent: zaterdag 10 december 2011 23:41
To: Laat de, Jos (KNMI)
Cc: mat...@li...
Subject: Re: [Matplotlib-users] Plotting basemap on top of other data
HI,
My initial thought was that you need to use the "zorder" keyword
argument and set the zorder to a large value. However, the more I
thought about it, I'm not really sure how you are plotting the
satellite data. Can you provide a code snippet?
PTM
---
Patrick Marsh
Ph.D. Student / Liaison to the HWT
School of Meteorology / University of Oklahoma
Cooperative Institute for Mesoscale Meteorological Studies
National Severe Storms Laboratory
http://www.patricktmarsh.com
From: Benjamin R. <ben...@ou...> - 2011年12月13日 04:41:27
On Monday, December 12, 2011, Åke Kullenberg <ake...@gm...>
wrote:
> To confirm, the methods supporting interactive animation will not be
removed, right?
> I was just slightly worried after reading "The animation module is
intended to replace the backend-specific examples..." in the 'What's new
section' on the matplotlib website.
It means exactly what it says. It is intended to make animations easier
and backend-independent. This way, the examples are easier to understand
and more people can use mpl for basic animations.
The animation module actually uses the features (although there are some
bugs), so those things wont be removed anytime soon.
Ben Root
From: Åke K. <ake...@gm...> - 2011年12月13日 02:58:56
To confirm, the methods supporting interactive animation will not be
removed, right?
I was just slightly worried after reading "The animation module is intended
to replace the backend-specific examples..." in the 'What's new section' on
the matplotlib website.
On Mon, Dec 12, 2011 at 3:26 AM, Eric Firing <ef...@ha...> wrote:
> On 12/10/2011 11:27 PM, Åke Kullenberg wrote:
> > I am a heavy user of the animation blit technique as descried here
> >
> http://matplotlib.sourceforge.net/users/event_handling.html#draggable-rectangle-exerciseand
> > here http://www.scipy.org/Cookbook/Matplotlib/Animations.
> >
> > I just saw there is a new animation framework. Is this framework meant
> > to replace the above technique (a good example of it is the extra
> > credit solution from the first link)? If so, how can I use the new
> > framework in place of the old one?
>
> No, the animation framework is intended to make it easier to produce
> animations--sequences of frames displayed at uniform intervals. It does
> not address interactive functionality such as cursors, dragging, etc.
>
> Eric
>
>
>
> ------------------------------------------------------------------------------
> Learn Windows Azure Live! Tuesday, Dec 13, 2011
> Microsoft is holding a special Learn Windows Azure training event for
> developers. It will provide a great way to learn Windows Azure and what it
> provides. You can attend the event by watching it streamed LIVE online.
> Learn more at http://p.sf.net/sfu/ms-windowsazure
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

Showing 19 results of 19

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