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





Showing results of 176

1 2 3 .. 8 > >> (Page 1 of 8)
From: Tanim I. <tan...@gm...> - 2012年04月30日 20:03:41
Yes, sorry about that. I hope this now works.
Tanim Islam
On 2012年4月30日, Benjamin Root wrote:
> 
> 
> On Mon, Apr 30, 2012 at 2:02 PM, Tanim Islam <tan...@gm...> wrote:
> Apologies, but attached to this email are the 2 python scripts I have neglected to attach to the previous email.
> Tanim Islam
> 
> 
> Tanim,
> 
> Could you try that again? No python scripts came with that email.
> 
> Ben Root
> 
> 
>
From: Benjamin R. <ben...@ou...> - 2012年04月30日 18:43:04
On Mon, Apr 30, 2012 at 2:02 PM, Tanim Islam <tan...@gm...> wrote:
> Apologies, but attached to this email are the 2 python scripts I have
> neglected to attach to the previous email.
>
> Tanim Islam
>
>
Tanim,
Could you try that again? No python scripts came with that email.
Ben Root
From: Tanim I. <tan...@gm...> - 2012年04月30日 18:02:40
Apologies, but attached to this email are the 2 python scripts I have
neglected to attach to the previous email.
Tanim Islam
From: Tanim I. <tan...@gm...> - 2012年04月30日 18:00:30
Hello:
I believe I may have uncovered some unusual behavior wrt to Axes3D.scatter.
 - When I run the attached and self-contained problem,
 "demo_colorbar_3d.py," I am able to create a colorbar and the 3d scatter
 points are normally created.
 - However, in the attached python script "demo_data_3d.py," when I read
 a set of XYZ data from a file and place into separate XYZ arrays, I am able
 to create the appropriately limited and colored colorbar, but all the
 scatter points appear black.
The data input for "demo_data_3d.py," "data_output.txt," and png
screenshots "demo_colorbar_3d.pdf" and "demo_data_3d.pdf," are located in a
the following public Dropbox links are here:
 - demo_data_3d.pdf <http://dl.dropbox.com/u/7140790/demo_data_3d.pdf>
 - data_output.txt <http://dl.dropbox.com/u/7140790/data_output.txt>
 - demo_colorbar_3d.pdf<http://dl.dropbox.com/u/7140790/demo_colorbar_3d.pdf>
Thank you,
Tanim Islam
From: Ignas A. <ani...@gm...> - 2012年04月30日 12:39:55
On 30/04/12 02:15, Benjamin Root wrote:
> Use pcolormesh(). *much* faster if you can assume certain things about
> the domain.
> 
> Ben Root 
Thank you very much!
Ignas
From: Benjamin R. <ben...@ou...> - 2012年04月30日 01:16:06
On Sunday, April 29, 2012, Ignas Anikevičius wrote:
> Hello everybody,
>
> On 28 April 2012 12:13, julien tayon <ju...@ta... <javascript:_e({},
> 'cvml', 'ju...@ta...');>> wrote:
>
>> First cpp stands for C Pre Processor, this tool usually does macro
>> substitution in c, objective c, c++. Hence Cpp in the object is pretty
>> much confusing when it seems to be talking about C++.
>>
>
> Sorry for my ignorance, will know it in the future
>
>
>> There is another simpler solution however :
>> Do everything in python : python is a very powerfull gluing langage,
>> the GIL ensuring that non thread-safe code is thread safe, it is very
>> forgiving with code not design for concurrency.
>>
>
> I wanted to write in Python as much code as possible, it is just some plot
> commands are quite slow in matplotlib. For example, I want to work in polar
> coordinate system to plot a function of 2 variables. For that I want to use
> the np.meshgrid function and the plot the results with the pcolor command
> from pyplot. The problem is that with a lot of data points it becomes very
> slow, which is not acceptable if one wants to draw a lot of plots using
> this function. Because the array is not ordered and points in space are at
> irregular intervals, I could not use imshow, which is much much faster. So
> I was thinking if there is some internal C++ API which I could use and
> maybe speed up the plotting itself a bit.
>
> It would actually be very nice if I could do that as most of the toolkits,
> which can interface with C/C++ do not have LaTeX capabilites. Gnuplot can
> be used in C/C++, but as far as I remember it is not the most elegant way
> of doing it...
>
> Going back to the topic, is there any potential to speed up some commands
> (e.g. pcolor) by rewriting/extending them in Cython or C++? If yes, then
> maybe I might tinker with the code at some point, when I have more free
> time.
>
> Anyway, thanks for such detailed answers.
>
> All best,
> Ignas A.
>
Use pcolormesh(). *much* faster if you can assume certain things about the
domain.
Ben Root
From: Ignas A. <ani...@gm...> - 2012年04月30日 00:38:19
Hello everybody,
On 28 April 2012 12:13, julien tayon <ju...@ta...> wrote:
> First cpp stands for C Pre Processor, this tool usually does macro
> substitution in c, objective c, c++. Hence Cpp in the object is pretty
> much confusing when it seems to be talking about C++.
>
Sorry for my ignorance, will know it in the future
> There is another simpler solution however :
> Do everything in python : python is a very powerfull gluing langage,
> the GIL ensuring that non thread-safe code is thread safe, it is very
> forgiving with code not design for concurrency.
>
I wanted to write in Python as much code as possible, it is just some plot
commands are quite slow in matplotlib. For example, I want to work in polar
coordinate system to plot a function of 2 variables. For that I want to use
the np.meshgrid function and the plot the results with the pcolor command
from pyplot. The problem is that with a lot of data points it becomes very
slow, which is not acceptable if one wants to draw a lot of plots using
this function. Because the array is not ordered and points in space are at
irregular intervals, I could not use imshow, which is much much faster. So
I was thinking if there is some internal C++ API which I could use and
maybe speed up the plotting itself a bit.
It would actually be very nice if I could do that as most of the toolkits,
which can interface with C/C++ do not have LaTeX capabilites. Gnuplot can
be used in C/C++, but as far as I remember it is not the most elegant way
of doing it...
Going back to the topic, is there any potential to speed up some commands
(e.g. pcolor) by rewriting/extending them in Cython or C++? If yes, then
maybe I might tinker with the code at some point, when I have more free
time.
Anyway, thanks for such detailed answers.
All best,
Ignas A.
From: Chao Y. <cha...@gm...> - 2012年04月29日 10:10:28
I should use mat.collections.LineCollection([line])
cheers,
Chao
2012年4月29日 Chao YUE <cha...@gm...>
> Dear all,
>
> I want to make an example of collections.LineCollection instance. So I have
>
> In [150]: line
> Out[150]: [(0, 0), (0, 1), (1, 1), (1, 0)]
>
> but I use whatever the following I meet with an Assertion Error:
>
> mat.collections.LineCollection(np.array(line))
> mat.collections.LineCollection(tuple(line))
> mat.collections.LineCollection(line)
>
> could anyone explain me a little bit?
>
> thanks et cheers,
>
> Chao
>
> --
>
> ***********************************************************************************
> Chao YUE
> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
> UMR 1572 CEA-CNRS-UVSQ
> Batiment 712 - Pe 119
> 91191 GIF Sur YVETTE Cedex
> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
>
> ************************************************************************************
>
>
-- 
***********************************************************************************
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
************************************************************************************
From: Chao Y. <cha...@gm...> - 2012年04月28日 22:19:36
Dear all,
I want to make an example of collections.LineCollection instance. So I have
In [150]: line
Out[150]: [(0, 0), (0, 1), (1, 1), (1, 0)]
but I use whatever the following I meet with an Assertion Error:
mat.collections.LineCollection(np.array(line))
mat.collections.LineCollection(tuple(line))
mat.collections.LineCollection(line)
could anyone explain me a little bit?
thanks et cheers,
Chao
-- 
***********************************************************************************
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
************************************************************************************
From: julien t. <ju...@ta...> - 2012年04月28日 12:13:19
First cpp stands for C Pre Processor, this tool usually does macro
substitution in c, objective c, c++. Hence Cpp in the object is pretty
much confusing when it seems to be talking about C++.
2012年4月27日 Benjamin Root <ben...@ou...>:
>
>
> On Fri, Apr 13, 2012 at 4:24 PM, Ignas Anikevicius <ani...@gm...>
> wrote:
>>
>> Dear all,
>>
>> I was wondering if it is possible to use matplotlib from C++ directly
>> and I have found an example on how to do this on StackOverflow:
>>
>>
Hello,
>> http://stackoverflow.com/questions/2509156/anyone-knows-a-matplotlib-equivalent-in-c-or-c
>>
>
> Well, using that "method", you could interface with any python libraries in
> C++, but you wouldn't be able to do anything useful.
>
I dont quite get it Ben.
The stackoverflow is pretty revelant.
using #include <python.h> is smart: you can avoid all the free/malloc
in GC byt using python data structure and use this in your C code. And
I know C/C++ dev using this trick in real open source project since
python.h is less complicated to use than all the kombinat from boost.
But, I would not use this method. (Question of taste and of
complexity).
There is another simpler solution however :
Do everything in python : python is a very powerfull gluing langage,
the GIL ensuring that non thread-safe code is thread safe, it is very
forgiving with code not design for concurrency.
***** ctypes permits the direct loading and binding with C++ classes,
or C functions.
http://stackoverflow.com/questions/1615813/how-to-use-c-classes-with-ctypes
http://docs.python.org/library/ctypes.html
**** Another solution that seems impressive, is writing C/C++
extensions in python. It is very easy (I self learnt it in one day
even though IQ test rank me 20 points below average).
http://docs.python.org/extending/extending.html
The benefit is you could use your C++ code to return native python
object (set, array, dict, string, unicode, int (arbitrary long int)
...).
My advice for big stream of data is you can return an iterator on the
stream of data, thus limiting the memory usage if it is important
(dont if you dont need it, premature optimization is the root of all
evil).
if your c++ code becomes an extension of python, it's deployment in an
ecosystem of python instances will be made easier through the use of
distribute.
This gluing will ensure your data will flow without all the quirks
related to popen (caching of stdout/in, no control on mermory use ,
interruptions, portability issues ...).
The first solution is easy to achieve, the second solution requires
more time but is funnier.
Cheers;
-- 
Jul
From: francesco o. <fra...@gm...> - 2012年04月28日 09:53:08
Hi,
if I understand well, you have a program producing data which usually are
stored in a file,
then you load such file into a matplotlib script.
Your goal is trasfering data from your program to matplotlib.
If this is the case you can follow two routes:
1) Modify the progam in order to print the information on standard output.
 Then, through the function popen, you execute your program into
matplotlib, reading directly
 the data without any external file.
2) if you cannot mpdify you program, you can execute in popen something
like:
 program file.out; cat file.out.
 Again, your data are on the displayed on the standard output which is
captured by popen
Francesco
2012年4月27日 Moore, Eric (NIH/NIDDK) [F] <eri...@ni...>
> > -----Original Message-----
> > From: Ignas Anikevicius [mailto:ani...@gm...]
> > Sent: Friday, April 13, 2012 4:25 PM
> > To: mat...@li...
> > Subject: [Matplotlib-users] Matplotlib and Cpp
> >
> > Dear all,
> >
> > I was wondering if it is possible to use matplotlib from C++ directly
> > and I have found an example on how to do this on StackOverflow:
> >
> > http://stackoverflow.com/questions/2509156/anyone-knows-a-matplotlib-
> > equivalent-in-c-or-c
> >
> > However, my question is about piping. Where could I find any tutorials
> > on how to pipe data directly to matplotlib so that I would not need to
> > right it to a file and then read it?
> >
> > Also, does matplotlib benefit from usage of cython and if it does, are
> > there any things I should know before just trying to compile a
> > matplotlib script with cython?
> >
> > All best,
> > Ignas A.
> >
>
> You're trying to solve the wrong problem. If you want to use matplotlib
> to show your results this way the easiest thing to do would be to rework so
> that python was the driver. i.e wrap your C++ code so that a python
> program called it instead of trying to call python from C++.
>
> The better solution here is probably to abandon matplotlib and use a
> plotting library that has C bindings. One example is DISLIN, but I'm sure
> there are others (and don't take this as a recommendation.)
>
> Eric
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
-- 
Cordiali saluti, Dr.Oteri Francesco
From: Benjamin R. <ben...@ou...> - 2012年04月28日 02:02:53
On Friday, April 27, 2012, tanim wrote:
> Hello:
>
> Are there any restrictions or best practices for posting problems or
> issues one has with matplotlib/pyplot? I ask, because one of the data sets
> that demonstrates unexpected behavior in matplotlib is ~300k in size (I
> can reduce it if necessary).
>
> Tanim Islam
>
>
If you need to use a particular dataset to demonstrate a problem, what
would probably work best is to put it in a Dropbox, or google drive, etc.
account and provide a link to download it. The same goes for images that
are too large, as well.
I hope that helps!
Ben Root
From: tanim <tan...@gm...> - 2012年04月28日 01:19:06
Hello:
Are there any restrictions or best practices for posting problems or 
issues one has with matplotlib/pyplot? I ask, because one of the data sets 
that demonstrates unexpected behavior in matplotlib is ~300k in size (I 
can reduce it if necessary).
Tanim Islam
From: willfurnass <wi...@th...> - 2012年04月27日 17:57:39
On Thu, Apr 26, 2012 at 12:51 PM, willfurnass <wi...@th...> wrote:
>
> I've converted a simple MATLAB script [1] for wavelet decomposition-based
> analysis to Python. I now want to create figures similar to [2] that
> feature five subplots in one column, with the 1st and 3rd being generated
> using 'subplot.plot' and the others being generated using
> 'subplot.imshow'.
>
> I want to find a way of scaling the x and y axes of all subplots so that
> they're the same size on screen across all subplots. Unfortunately I
> can't
> find any combination of 'aspect' or 'extent' that will let me do this. I
> should note that I've added colorbars to all my image plots; the problem
> exists regardless of whether these are used.
>
> [1]
>
> http://www.mathworks.com/matlabcentral/fileexchange/18409-comparing-time-series-using-semblance-analysis
> [2] http://www.mathworks.com/matlabcentral/fx_files/18409/1/goldoil.jpg
You could try
 fig, axes = plt.subplots(nrows=5, sharex=True, sharey=True)
And then call `axes[0].plot(...)` and `axes[1].imshow(...)`. You could also
unpack the axes array and access them that way (if you prefer):
 ax0, ax1, ax2, ax3, ax4 = axes
 ax0.plot(...)
----
Hi Tony and others,
Thanks for the suggestion Tony. It works if I remove my colour bars.
However if the colour bars are enabled (for the images on the 2nd, 4th
and 5th rows) then the image on the 5th and last row is squashed up on
the LHS of the subplot area to make room for all 3 (!) colour bars,
even though all subplots should share an x axis. Any further
suggestions?
Also, I'm still having problems getting tick labels on ax.plot() and
ax.imshow() subplots to line up:
I create one subplot using plot(t_vec, y_vec)
I then create an image using t_vec and y_vec and display it as a second
subplot using imshow(image); the width of the image matrix is len(t_vec)
(not t_vec.max())
I am looking for a sane way of displaying the two subplots above each other
so that they are both the same width in pixels and have x tick labels at
consistent intervals (in pixels) that correspond to multiples of some value
of t.
I have tried using
ax.xaxis.set_major_formatter(ticker.FuncFormatter(xformat)) to scale the
image subplot ticks but can't get this to work in conjunction with the
setting of the tick intervals on both subplot axes using set_xticks. Has
anyone got any suggestions? 
Regards,
Will
-- 
View this message in context: http://old.nabble.com/Set-x-axis-length-of-all-subplots-to-same-width-on-screen-tp33753799p33760460.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: willfurnass <wi...@th...> - 2012年04月27日 17:56:31
On Thu, Apr 26, 2012 at 12:51 PM, willfurnass <wi...@th...> wrote:
>
> I've converted a simple MATLAB script [1] for wavelet decomposition-based
> analysis to Python. I now want to create figures similar to [2] that
> feature five subplots in one column, with the 1st and 3rd being generated
> using 'subplot.plot' and the others being generated using
> 'subplot.imshow'.
>
> I want to find a way of scaling the x and y axes of all subplots so that
> they're the same size on screen across all subplots. Unfortunately I
> can't
> find any combination of 'aspect' or 'extent' that will let me do this. I
> should note that I've added colorbars to all my image plots; the problem
> exists regardless of whether these are used.
>
> [1]
>
> http://www.mathworks.com/matlabcentral/fileexchange/18409-comparing-time-series-using-semblance-analysis
> [2] http://www.mathworks.com/matlabcentral/fx_files/18409/1/goldoil.jpg
You could try
 fig, axes = plt.subplots(nrows=5, sharex=True, sharey=True)
And then call `axes[0].plot(...)` and `axes[1].imshow(...)`. You could also
unpack the axes array and access them that way (if you prefer):
 ax0, ax1, ax2, ax3, ax4 = axes
 ax0.plot(...)
----
Hi Tony and others,
Thanks for the suggestion Tony. It works if I remove my colour bars.
However if the colour bars are enabled (for the images on the 2nd, 4th
and 5th rows) then the image on the 5th and last row is squashed up on
the LHS of the subplot area to make room for all 3 (!) colour bars,
even though all subplots should share an x axis. Any further
suggestions?
Also, I'm still having problems getting tick labels on ax.plot() and
ax.imshow() subplots to line up:
I create one subplot using plot(t_vec, y_vec)
I then create an image using t_vec and y_vec and display it as a second
subplot using imshow(image); the width of the image matrix is len(t_vec)
(not t_vec.max())
I am looking for a sane way of displaying the two subplots above each other
so that they are both the same width in pixels and have x tick labels at
consistent intervals (in pixels) that correspond to multiples of some value
of t.
I have tried using
ax.xaxis.set_major_formatter(ticker.FuncFormatter(xformat)) to scale the
image subplot ticks but can't get this to work in conjunction with the
setting of the tick intervals on both subplot axes using set_xticks. Has
anyone got any suggestions? 
Regards,
Will
-- 
View this message in context: http://old.nabble.com/Set-x-axis-length-of-all-subplots-to-same-width-on-screen-tp33753799p33760459.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Moore, E. (NIH/N. [F] <eri...@ni...> - 2012年04月27日 17:48:09
> -----Original Message-----
> From: Ignas Anikevicius [mailto:ani...@gm...]
> Sent: Friday, April 13, 2012 4:25 PM
> To: mat...@li...
> Subject: [Matplotlib-users] Matplotlib and Cpp
> 
> Dear all,
> 
> I was wondering if it is possible to use matplotlib from C++ directly
> and I have found an example on how to do this on StackOverflow:
> 
> http://stackoverflow.com/questions/2509156/anyone-knows-a-matplotlib-
> equivalent-in-c-or-c
> 
> However, my question is about piping. Where could I find any tutorials
> on how to pipe data directly to matplotlib so that I would not need to
> right it to a file and then read it?
> 
> Also, does matplotlib benefit from usage of cython and if it does, are
> there any things I should know before just trying to compile a
> matplotlib script with cython?
> 
> All best,
> Ignas A.
> 
You're trying to solve the wrong problem. If you want to use matplotlib to show your results this way the easiest thing to do would be to rework so that python was the driver. i.e wrap your C++ code so that a python program called it instead of trying to call python from C++.
The better solution here is probably to abandon matplotlib and use a plotting library that has C bindings. One example is DISLIN, but I'm sure there are others (and don't take this as a recommendation.)
Eric
From: Benjamin R. <ben...@ou...> - 2012年04月27日 17:29:48
On Fri, Apr 13, 2012 at 4:24 PM, Ignas Anikevicius <ani...@gm...>wrote:
> Dear all,
>
> I was wondering if it is possible to use matplotlib from C++ directly
> and I have found an example on how to do this on StackOverflow:
>
>
> http://stackoverflow.com/questions/2509156/anyone-knows-a-matplotlib-equivalent-in-c-or-c
>
>
Well, using that "method", you could interface with any python libraries in
C++, but you wouldn't be able to do anything useful.
> However, my question is about piping. Where could I find any tutorials
> on how to pipe data directly to matplotlib so that I would not need to
> right it to a file and then read it?
>
>
Not from C++, sorry. matplotlib is primarially python with some C++ stuff
for efficiency.
> Also, does matplotlib benefit from usage of cython and if it does, are
> there any things I should know before just trying to compile a
> matplotlib script with cython?
>
>
matplotlib does not use Cython, it uses CXX for accelerating special parts
of the library. Maybe you can use matplotlib in cython (I have never
tried), but there are no cython bindings that I am aware of for matplotlib.
Sorry I could not be of more help.
Ben Root
From: Benjamin R. <ben...@ou...> - 2012年04月27日 14:39:35
On Fri, Apr 27, 2012 at 10:11 AM, Francesco Montesano <
fra...@go...> wrote:
> Dear matplotlibers,
>
> I know almost nothing about mpl_toolkits (matplolib.__version__ = 1.1.0).
> >From the help of
> "mpl_toolkits.axisartist.floating_axes.FloatingSubplot", the init
> function reads
> __init__(self, fig, *args, **kwargs)
>
> In the example here
> (
> http://matplotlib.sourceforge.net/examples/axes_grid/demo_floating_axes.html
> )
> the object is initialised as
> FloatingSubplot(fig, rect, grid_helper=grid_helper)
>
> If I take out 'grid_helper' I get this error:
> "ValueError: FloatingAxes requires grid_helper argument"
>
> In my understanding, **kwargs (like grid_helper) are optional
> arguments and I think that 'required' options do not make much sense.
> Besides its not documented in the help of the class.
>
> Could grid_helper be upgraded to *args?
>
> Cheers,
> Francesco
>
>
Francesco,
Yes and no. In the most basic sense, the **kwargs are generally considered
as optional. However, in some very advance python code, we use the
argument unpacking features of (*args, **kwargs) to create a more agnostic
API (duck-typing for call signatures, if you will). Unfortunately, I don't
think we can update the call signature until we can drop python 2.x support.
The doc string you see when you look up FloatingSubplot is actually from
the class definition a few superclasses up. If this makes no sense, you
aren't alone... The way FloatingSubplot is made is extremely convoluted and
I am still trying to wrap my head around it. A docstring should probably
be added for the __init__ function of FloatingAxesBase so that its
constructor could be better explained.
Ben Root
From: Francesco M. <fra...@go...> - 2012年04月27日 14:12:05
Dear matplotlibers,
I know almost nothing about mpl_toolkits (matplolib.__version__ = 1.1.0).
>From the help of
"mpl_toolkits.axisartist.floating_axes.FloatingSubplot", the init
function reads
__init__(self, fig, *args, **kwargs)
In the example here
(http://matplotlib.sourceforge.net/examples/axes_grid/demo_floating_axes.html)
the object is initialised as
 FloatingSubplot(fig, rect, grid_helper=grid_helper)
If I take out 'grid_helper' I get this error:
"ValueError: FloatingAxes requires grid_helper argument"
In my understanding, **kwargs (like grid_helper) are optional
arguments and I think that 'required' options do not make much sense.
Besides its not documented in the help of the class.
Could grid_helper be upgraded to *args?
Cheers,
Francesco
From: Francesco M. <fra...@go...> - 2012年04月27日 13:30:19
Dear Nils,
I think that I've found what you need (example adapted from
http://notes.brooks.nu/2008/03/plotting-on-left-and-right-axis-simulateously-using-matplotlib-and-numpy/
)
import matplotlib.pyplot as plt
import numpy as np
#data to plot
x = np.linspace(0,5,num=100)
y = np.sinc(x)
fig = plt.figure(figsize=(16,10)) #figure
ax = fig.add_subplot(111) #axis containing the figure
ax1 = fig.add_subplot(111, sharex=ax, sharey=ax, frameon=False)
#axis that shares both x and y and without frame (so ax is visible)
ax.plot(x, y) #plot the data
ax1.xaxis.tick_top() #show ticks on top
ax1.yaxis.tick_right() #show ticks on the right
Now if you do any modification on the ax limits should reflect on ax1.
Might be that there is some smarter way of doing it, but if the
project is not too long and efficiency is not a problem, I think that
this example will suffice
Cheers,
Francesco
Il 27 aprile 2012 14:50, Nils Wagner <ni...@go...> ha scritto:
> Dear Francesco,
>
> Thank you for your prompt reply !
> My incomplete example is below.
>
> import matplotlib.pyplot as plt
> fig  = plt.figure(figsize=(16,10))
> ax  = fig.add_subplot(111)
> ind = np.arange(nfreq)
> yoff = np.array([0.0]*nfreq)
> for row in range(nsets):
>
>  ax.bar(ind,A[row,:],width,bottom=yoff, color=colours[row],label=elabel[row])
>  yoff = yoff + A[row,:]
>
> plt.legend(loc="upper left", bbox_to_anchor=(1,1))
> plt.xticks(ind+0.5*width,np.arange(nfreq)+1,rotation=90)
> ax.set_xlim(0.,nfreq)
> ax.set_ylim(0.,102.)
> plt.subplots_adjust(left=0.075, right=0.85, top=0.9, bottom=0.05)
> plt.show()
>
> How can I add xtick labels on the top of my figure ?
>
> Cheers,
>        Nils
>
>
> On 4/27/12, Francesco Montesano <fra...@go...> wrote:
>> Dear Nils,
>>
>> you can try to play with
>> i) ax.axis["right", "top", "bottom", "left"] and their methods (see
>> setup_axis3 here
>> http://matplotlib.sourceforge.net/examples/axes_grid/demo_floating_axes.html
>> for an example)
>> ii) twinx and twiny axes (example
>> http://matplotlib.sourceforge.net/examples/api/two_scales.html )
>>
>> The first one can be a bit confusing with orientations. Once I found
>> an explanation about it on matplotlib website, but I cannot find it
>> right now.
>> The second way creates a second axis that you probably don't need.
>>
>> Cheers,
>> Francesco
>>
>> Il 27 aprile 2012 11:48, Nils Wagner <nw...@ia...> ha
>> scritto:
>>> Hi all,
>>>
>>> I would like to add different xtick labels on the top and
>>> bottom of a figure. The number and position of the xticks
>>> is the same.
>>> How can I do that ?
>>>
>>> An example would be appreciated.
>>>
>>> Nils
>>>
>>> ------------------------------------------------------------------------------
>>> Live Security Virtual Conference
>>> Exclusive live event will cover all the ways today's security and
>>> threat landscape has changed and how IT managers can respond. Discussions
>>> will include endpoint security, mobile security and the latest in malware
>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
-- 
personals: mon...@ya..., mon...@ho... (messenger),
fra...@go....
work: mon...@mp...
http://picasaweb.google.it/franz.bergesund
From: Francesco M. <fra...@go...> - 2012年04月27日 10:23:08
Dear Nils,
you can try to play with
i) ax.axis["right", "top", "bottom", "left"] and their methods (see
setup_axis3 here
http://matplotlib.sourceforge.net/examples/axes_grid/demo_floating_axes.html
for an example)
ii) twinx and twiny axes (example
http://matplotlib.sourceforge.net/examples/api/two_scales.html )
The first one can be a bit confusing with orientations. Once I found
an explanation about it on matplotlib website, but I cannot find it
right now.
The second way creates a second axis that you probably don't need.
Cheers,
Francesco
Il 27 aprile 2012 11:48, Nils Wagner <nw...@ia...> ha scritto:
> Hi all,
>
> I would like to add different xtick labels on the top and
> bottom of a figure. The number and position of the xticks
> is the same.
> How can I do that ?
>
> An example would be appreciated.
>
> Nils
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Nils W. <nw...@ia...> - 2012年04月27日 10:07:31
Hi all,
I would like to add different xtick labels on the top and 
bottom of a figure. The number and position of the xticks 
is the same.
How can I do that ?
An example would be appreciated.
Nils
From: Fabien L. <laf...@gm...> - 2012年04月27日 09:21:04
Hello everyone,
I Have a problem. I have a graph inserted in a PyQt interface and I
want to clear it (When I click on a button).
I initialise the graph like that:
class Graph(FigureCanvas):
 def __init__(self,parent):
 self.fig = Figure()
 self.ax = self.fig.add_subplot(111)
 FigureCanvas.__init__(self, self.fig)
 self.R1, time,= [], []
 self.l_R1, = self.ax.plot([], self.R1,"-o", color = 'b',
label='R1')
 self.fig.canvas.draw()
 FigureCanvas.updateGeometry(self)
Later on the program I append values to the arrays: self.R1 and time and I do:
self.l_R1.set_data(time, self.R1)
self.fig.canvas.draw()
FigureCanvas.updateGeometry(self)
So the values are correctly added to the Graph. My problem is I want
to clear the graph and re-initialize the arrays self.R1 and time to
empty arrays.
I've tried to create a def activated by a button that do:
 self.R1, time,= [], []
 self.l_R1, = self.ax.plot([], self.R1,"-o", color = 'b',
label='R1')
 self.fig.canvas.draw()
 FigureCanvas.updateGeometry(self)
But no effects...
Anybody has an idea?
Thanks!
Fab
From: Bruce F. <br...@cl...> - 2012年04月26日 21:10:22
Excellent! Thanks Jeff!
---------------------------------------
Bruce W. Ford
Clear Science, Inc.
br...@cl...
http://www.ClearScienceInc.com
http://www.facebook.com/clearscience
http://www.twitter.com/ROVs_rule
Phone: (904) 796-8101
Fax: (904) 379-9704
8241 Parkridge Circle N.
Jacksonville, FL 32211
Skype: bruce.w.ford
On Thu, Apr 26, 2012 at 3:41 PM, Jeff Whitaker
<jef...@no...>wrote:
> On 4/24/12 7:39 AM, Bruce Ford wrote:
>
>> All,
>>
>> I often produce images for use in .KML with Google Earth. Sometimes I
>> need the masking effect of matplotlib.toolkits.basemap.**Basemap.fillcontinents
>> but in the case of Google Earth, I need to make continents transparent on
>> the final image. Any ideas on how to do this?
>>
>> Thanks!
>>
>> Bruce
>>
>> ------------------------------**---------
>> Bruce W. Ford
>>
>>
>>
> Bruce: I just added an "alpha" keyword to fillcontinents in git master.
>
> -Jeff
>
> --
> Jeffrey S. Whitaker Phone : (303)497-6313
> Meteorologist FAX : (303)497-6449
> NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
> 325 Broadway Office : Skaggs Research Cntr 1D-113
> Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
>
>
From: Jeff W. <jef...@no...> - 2012年04月26日 19:41:55
On 4/24/12 7:39 AM, Bruce Ford wrote:
> All,
>
> I often produce images for use in .KML with Google Earth. Sometimes I 
> need the masking effect 
> of matplotlib.toolkits.basemap.Basemap.fillcontinents but in the case 
> of Google Earth, I need to make continents transparent on the final 
> image. Any ideas on how to do this?
>
> Thanks!
>
> Bruce
>
> ---------------------------------------
> Bruce W. Ford
>
>
Bruce: I just added an "alpha" keyword to fillcontinents in git master.
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
3 messages has been excluded from this view by a project administrator.

Showing results of 176

1 2 3 .. 8 > >> (Page 1 of 8)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /