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 results of 208

<< < 1 .. 3 4 5 6 7 .. 9 > >> (Page 5 of 9)
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
>
From: Paul H. <pmh...@gm...> - 2011年12月12日 21:46:37
On Wed, Nov 30, 2011 at 7:43 PM, Benjamin Root <ben...@ou...> wrote:
> As an additional note, would it be a desirable feature to be able to cycle
> hash styles in the case of producing b&w plots?
>
> Ben Root
Ben,
I think this would be quite useful. How are you thinking of
implementing it? Cycling through
lines = ['-', '--', '-.', etc] or through dashes = [(20,10), (5,5),
(30,7), etc]?
-paul
From: Benjamin R. <ben...@ou...> - 2011年12月12日 19:04:03
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
From: David H. <dh...@gm...> - 2011年12月12日 16:01:58
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: Benjamin R. <ben...@ou...> - 2011年12月12日 15:43:27
On Fri, Dec 9, 2011 at 8:45 PM, Aycha Tammour <ata...@uw...> wrote:
> Hello,
>
> I am trying to make a figure with a text that includes H$\beta$ but for
> some reason matplotlib would freeze. I cannot understand what's wrong with
> $\beta$. I tried other Greek letters and some of them worked but not all.
>
> Any suggestions?
>
> Cheers,
> Aycha
>
>
Aycha,
Which version of matplotlib are you using and on which OS?
Ben Root
From: Fabien L. <laf...@gm...> - 2011年12月12日 15:16:55
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: Daniel H. <dh...@gm...> - 2011年12月11日 22:00:25
Thanks so much Tony...that does indeed work. I'm not sure if I understand
exactly why, but I'll continue to bang my head on it for a while ;)
The set_transform() call is needed if you throw the collection into the
axes.artists list, but not if axes.add_collection() is used to (ahem) add
the collection.
On Fri, Dec 9, 2011 at 5:27 PM, Tony Yu <ts...@gm...> wrote:
>
> On Fri, Dec 9, 2011 at 5:23 PM, Tony Yu <ts...@gm...> wrote:
>
>>
>>
>> On Fri, Dec 9, 2011 at 4:11 PM, Daniel Hyams <dh...@gm...> wrote:
>>
>>> I'm sorry, I should have stated the version. I'm using 1.0.0, which
>>> just returns a list of rectangle artists.
>>>
>>>
>>> On Fri, Dec 9, 2011 at 4:08 PM, Benjamin Root <ben...@ou...> wrote:
>>>
>>>> On Fri, Dec 9, 2011 at 2:55 PM, Daniel Hyams <dh...@gm...> wrote:
>>>>
>>>>> Tried, but unfortunately it did not make any difference :(
>>>>>
>>>>>
>>>> Just as an interesting point... don't know if it means anything. In
>>>> v1.1.x, we now return a "BarContainer" from the bar() function. This
>>>> container subclasses the tuple type, which is why you are still able to
>>>> treat it like a list. Anyway, this class does a bunch of things that I
>>>> wonder if it could be interfering with what you are trying to do. Probably
>>>> not, but still...
>>>>
>>>> Ben Root
>>>>
>>>>
>>>
>>>
>>> --
>>> Daniel Hyams
>>> dh...@gm...
>>>
>>
>> So I think the problem is that ``plt.bar`` assigns a transform to each
>> patch (as it should). But then when pass these patches to PatchCollection,
>> the collection applies it's own transform (but doesn't ignore the patch's
>> transform, apparently). The solution is to clear out the transform on each
>> patch---where "clearing" a transform translates to setting it to the
>> IdentityTransform.
>>
>> Below is code that works *on my system*. It sounds like it will work
>> slightly differently on your system:
>>
>>
>> #!/usr/bin/env python
>> import numpy
>> import matplotlib.pyplot as plt
>> import matplotlib.collections
>> import matplotlib.transforms as transforms
>>
>>
>> # just generate some data to plot
>> x = numpy.linspace(0.0,2.0*numpy.pi,10)
>> y = numpy.sin(x)
>>
>> # plot
>> axes = plt.gca()
>> bars = plt.bar(x,y,color='red',width=0.1)
>>
>> axes.patches = []
>> for p in bars.patches:
>> p.set_transform(transforms.IdentityTransform())
>>
>> ## and create a collection for plotting the rectangles instead.
>> coll = matplotlib.collections.PatchCollection(bars.patches)
>>
>> coll.set_transform(axes.transData)
>> axes.add_collection(coll, autolim=True)
>>
>> plt.xlim(0.0,2.0*numpy.pi)
>> plt.grid(True)
>> plt.show()
>>
>>
>>
> P.S. you don't need the call to set_transform that I accidentally added.
>
-- 
Daniel Hyams
dh...@gm...
From: Eric F. <ef...@ha...> - 2011年12月11日 19:31:02
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-exercise and
> 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
From: Åke K. <ake...@gm...> - 2011年12月11日 09:27:33
I am a heavy user of the animation blit technique as descried here
http://matplotlib.sourceforge.net/users/event_handling.html#draggable-rectangle-exercise
and
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?
From: Patrick M. <pat...@gm...> - 2011年12月10日 22:41:54
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
On Fri, Dec 9, 2011 at 6:58 AM, Laat de, Jos (KNMI) <jos...@kn...> wrote:
> I am working with (geostationary) satellite data, and one of the things I
> want to do is plot a map (coastlines) on top of the satellite image. As an
> IDL user I know how to do this in IDL (although in IDL it is a bit of a
> hassle), but I don’t seem to be able to figure out how this could be done in
> python.
>
>
>
> The satellite data consists of a rectangular field of N by N pixels. The
> data is already converted to bitmap RGB values. I have figured out how this
> can be written to a bitmap image like PNG or JPG.
>
>
>
> I further figured out how to do the satellite projection in Basemap, and how
> to plot Basemap coastlines. However, the Basemap appears to have a
> non-transparent background, which overplots all bitmap data if I plot the
> Bitmap data first. I had hoped that there would be some transparency setting
> in Basemap, but alas.
>
>
>
> (ps. Keep in mind that I do not want to use some contour filling routine for
> plotting the satellite data. I want to retain the original N x N pixels and
> image size)
>
>
> ------------------------------------------------------------------------------
> Cloud Services Checklist: Pricing and Packaging Optimization
> This white paper is intended to serve as a reference, checklist and point of
> discussion for anyone considering optimizing the pricing and packaging model
> of a cloud services business. Read Now!
> http://www.accelacomm.com/jaw/sfnl/114/51491232/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: David S. <dav...@gm...> - 2011年12月10日 18:12:09
I have been working on a program that uses Matplotlib to plot data
consisting of around one million points. Sometimes the plots succeed but
often I get an exception: OverFlowError: Agg rendering complexity exceeded.
I can make this message go away by plotting the data in "chunks" as
illustrated in the demo code below. However, the extra code is a chore
which I don't think should be necessary - I hope the developers will
be able to fix this issue sometime soon. I know that the development
version has some modifications to addressing this issue. I wonder if it is
expected to make the problem go away?
By the way, this plot takes about 30 seconds to render on my I7 2600k.
The main program reaches the show() statement quickly and prints
"Done plotting?". Then I see that the program reaches 100% usage
on one CPU core (4 real, 8 virtual on the 2600k) until the plot is
displayed. I wonder if there is any way to persuade Matplotlib to run
some of the chunks in parallel so as to use more CPU cores?
Plotting something other than random data, the plots run faster and
the maximum chunk size is smaller. The maximum chunk size
also depends on the plot size - it is smaller for larger plots. I am
wondering if I could use this to plot course and fine versions of the
plots. The course plot is zoomed in version of the small-sized raster.
That would be better than decimation as all the points would at least
be there.
Thanks in advance,
David
--------------------------- start code ---------------------------------
## Demo program shows how to "chunk" plots to avoid the exception:
##
##  OverflowError: Agg rendering complexity exceeded.
##  Consider downsampling or decimating your data.
##
## David Smith December 2011.
from pylab import *
import numpy as np
nPts=600100
x = np.random.rand(nPts)
y = np.random.rand(nPts)
## This seems to always succeed if Npts <= 20000, but fails
## for Npts > 30000. For points between, it sometimes succeeds
## and sometimes fails.
figure(1)
plot (x, y)
## Chunking the plot alway succeeds.
figure(2)
chunk_size=20000
iStarts=range(x.size/chunk_size)
for iStart in iStarts:
  print "Plotting chunk starting at %d\n" % iStart
  plot(x[iStart:iStart+chunk_size], y[iStart:iStart+chunk_size], '-b')
left_overs = nPts % chunk_size
if left_overs > 0:
  print "Leftovers %d points\n" % left_overs
  plot(x[-left_overs-1:], y[-left_overs-1:], '-r')
print "done plotting?"
show()
---------------------------------- end code ------------------------
Please don't reply to this post "It is rediculous to plot 1 million points on
screen". I am routinely capturing million-point traces from oscilloscopes and
other test equipment and to I need to be able to spot features in the
data (glitches if you will) that may not show up plotting decimated data.
I can then zoom the plot to inspect these features.
From: Alex N. <yeo...@gm...> - 2011年12月10日 16:36:27
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
My finite element program can be downloaded from here:
http://www.pynw.org.uk/Talks?action=AttachFile&do=view&target=2D_FEA.zip
From: Aycha T. <ata...@uw...> - 2011年12月10日 02:47:44
Hello,
I am trying to make a figure with a text that includes H$\beta$ but for
some reason matplotlib would freeze. I cannot understand what's wrong with
$\beta$. I tried other Greek letters and some of them worked but not all.
Any suggestions?
Cheers,
Aycha
From: Tony Yu <ts...@gm...> - 2011年12月09日 22:27:50
On Fri, Dec 9, 2011 at 5:23 PM, Tony Yu <ts...@gm...> wrote:
>
>
> On Fri, Dec 9, 2011 at 4:11 PM, Daniel Hyams <dh...@gm...> wrote:
>
>> I'm sorry, I should have stated the version. I'm using 1.0.0, which just
>> returns a list of rectangle artists.
>>
>>
>> On Fri, Dec 9, 2011 at 4:08 PM, Benjamin Root <ben...@ou...> wrote:
>>
>>> On Fri, Dec 9, 2011 at 2:55 PM, Daniel Hyams <dh...@gm...> wrote:
>>>
>>>> Tried, but unfortunately it did not make any difference :(
>>>>
>>>>
>>> Just as an interesting point... don't know if it means anything. In
>>> v1.1.x, we now return a "BarContainer" from the bar() function. This
>>> container subclasses the tuple type, which is why you are still able to
>>> treat it like a list. Anyway, this class does a bunch of things that I
>>> wonder if it could be interfering with what you are trying to do. Probably
>>> not, but still...
>>>
>>> Ben Root
>>>
>>>
>>
>>
>> --
>> Daniel Hyams
>> dh...@gm...
>>
>
> So I think the problem is that ``plt.bar`` assigns a transform to each
> patch (as it should). But then when pass these patches to PatchCollection,
> the collection applies it's own transform (but doesn't ignore the patch's
> transform, apparently). The solution is to clear out the transform on each
> patch---where "clearing" a transform translates to setting it to the
> IdentityTransform.
>
> Below is code that works *on my system*. It sounds like it will work
> slightly differently on your system:
>
>
> #!/usr/bin/env python
> import numpy
> import matplotlib.pyplot as plt
> import matplotlib.collections
> import matplotlib.transforms as transforms
>
>
> # just generate some data to plot
> x = numpy.linspace(0.0,2.0*numpy.pi,10)
> y = numpy.sin(x)
>
> # plot
> axes = plt.gca()
> bars = plt.bar(x,y,color='red',width=0.1)
>
> axes.patches = []
> for p in bars.patches:
> p.set_transform(transforms.IdentityTransform())
>
> ## and create a collection for plotting the rectangles instead.
> coll = matplotlib.collections.PatchCollection(bars.patches)
>
> coll.set_transform(axes.transData)
> axes.add_collection(coll, autolim=True)
>
> plt.xlim(0.0,2.0*numpy.pi)
> plt.grid(True)
> plt.show()
>
>
>
P.S. you don't need the call to set_transform that I accidentally added.
From: Tony Yu <ts...@gm...> - 2011年12月09日 22:23:12
On Fri, Dec 9, 2011 at 4:11 PM, Daniel Hyams <dh...@gm...> wrote:
> I'm sorry, I should have stated the version. I'm using 1.0.0, which just
> returns a list of rectangle artists.
>
>
> On Fri, Dec 9, 2011 at 4:08 PM, Benjamin Root <ben...@ou...> wrote:
>
>> On Fri, Dec 9, 2011 at 2:55 PM, Daniel Hyams <dh...@gm...> wrote:
>>
>>> Tried, but unfortunately it did not make any difference :(
>>>
>>>
>> Just as an interesting point... don't know if it means anything. In
>> v1.1.x, we now return a "BarContainer" from the bar() function. This
>> container subclasses the tuple type, which is why you are still able to
>> treat it like a list. Anyway, this class does a bunch of things that I
>> wonder if it could be interfering with what you are trying to do. Probably
>> not, but still...
>>
>> Ben Root
>>
>>
>
>
> --
> Daniel Hyams
> dh...@gm...
>
So I think the problem is that ``plt.bar`` assigns a transform to each
patch (as it should). But then when pass these patches to PatchCollection,
the collection applies it's own transform (but doesn't ignore the patch's
transform, apparently). The solution is to clear out the transform on each
patch---where "clearing" a transform translates to setting it to the
IdentityTransform.
Below is code that works *on my system*. It sounds like it will work
slightly differently on your system:
#!/usr/bin/env python
import numpy
import matplotlib.pyplot as plt
import matplotlib.collections
import matplotlib.transforms as transforms
# just generate some data to plot
x = numpy.linspace(0.0,2.0*numpy.pi,10)
y = numpy.sin(x)
# plot
axes = plt.gca()
bars = plt.bar(x,y,color='red',width=0.1)
axes.patches = []
for p in bars.patches:
 p.set_transform(transforms.IdentityTransform())
## and create a collection for plotting the rectangles instead.
coll = matplotlib.collections.PatchCollection(bars.patches)
coll.set_transform(axes.transData)
axes.add_collection(coll, autolim=True)
plt.xlim(0.0,2.0*numpy.pi)
plt.grid(True)
plt.show()
1 message has been excluded from this view by a project administrator.

Showing results of 208

<< < 1 .. 3 4 5 6 7 .. 9 > >> (Page 5 of 9)
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 によって変換されたページ (->オリジナル) /