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




Showing results of 394

<< < 1 2 3 4 5 .. 16 > >> (Page 3 of 16)
From: Ryan M. <rm...@gm...> - 2009年03月27日 17:39:24
On Fri, Mar 27, 2009 at 12:15 PM, Bala subramanian <
bal...@gm...> wrote:
> Dear All,
>
> I have to make multiple plot on the same page. Six row and three column.
> Kindly suggest me some tips to do the same.
>
Try: pyplot.subplot()
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.subplot
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from: Norman Oklahoma United States.
From: Pau <vim...@go...> - 2009年03月27日 17:35:09
sorry, problem fixed... I was using
linestyle='--', linewidth='7'
instead of
linestyle='--', linewidth=7
embarrassing ... But matplotlib would not complain when exporting to
pdf, nor to png etc... only ps/eps
thanks
2009年3月23日 Michael Droettboom <md...@st...>:
> Try switching to the Ps backend by putting:
>
> import matplotlib
> matplotlib.use("ps")
>
> at the top of your script. That will take gtk and its popup windows out of
> the equation.
>
> After doing that, you should get a traceback at the terminal that should
> help narrow this down. At this point we can only guess, without a line
> number.
>
> Can you also provide a minimal script that causes this error? I'm
> particularly puzzled by the difference in output between PDF and PS.
>
> Cheers,
> Mike
>
> Pau wrote:
>>
>> Hello,
>>
>> using 0.98.5.2 under OpenBSD -current
>>
>> I have made a plot and, when I try to save it as eps/ps, I get the
>> error "float argument required" in a pop-up window, whilst the
>> terminal shows this error message:
>>
>>
>> /usr/local/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py:1054:
>> GtkWarning: Unable to find default local directory monitor type
>> if self.run() != int(gtk.RESPONSE_OK):
>>
>> I can save it as pdf, but the quality is not what I want. The curves
>> do not have the thickness I gave them.
>>
>> I reproduced the same running it under Fedora 10.
>>
>> I have googled and yahooed. Found nothing.
>>
>> It looks as if the some function was expecting a decimal-point number
>> but got something else.
>>
>> I can send the .py and data, if you wish.
>>
>> Thanks,
>>
>> Pau
>>
>>
>> ------------------------------------------------------------------------------
>> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
>> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
>> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
>> software that enables intelligent coding and step-through debugging.
>> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
> --
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
>
>
From: Bala s. <bal...@gm...> - 2009年03月27日 17:15:13
Dear All,
I have to make multiple plot on the same page. Six row and three column.
Kindly suggest me some tips to do the same.
Bala
From: Cohen-Tanugi J. <joh...@gm...> - 2009年03月27日 15:16:11
Hello, what is the best way to get log log plots with error bars? I 
tried putting log10() everywhere but as I was afraid results look ugly....
thanks,
johann
From: John H. <jd...@gm...> - 2009年03月27日 13:25:52
On Thu, Mar 26, 2009 at 9:59 AM, Sandro Tosi <mo...@de...> wrote:
> Hi Jae-Joon,
> thanks for the reply.
>
> On Thu, Mar 26, 2009 at 02:51, Jae-Joon Lee <lee...@gm...> wrote:
> > You need to adjust the keyword arguments, such as head_width, etc. The
>
> But shouldn't the default arrow be a little bit "nicer" than it's now? :)
>
> > arrow command itself is poorly documented and its keyword arguments
> > are explained in
> > matplitlib.patches.FancyArrow.
>
> Ah, that's why even in pyploy.arrow() I could'nt find eny reference to
> head_width & friends. In case I have some time to share on improve
> arrow() docs, what docs should I look to? and changing
> 'doc/api/pyplot_api.rst' is the right place to achieve it?
>
> > However, I recommend you to use
> > annotate command instead of arrow (you can give empty string if you
> > just need an arrow). For example,
> >
> > annotate("", (0.2, 0.2), (0.4, 0.4),
> > arrowprops=dict(arrowstyle="->"))
> >
> > more examples,
> >
> >
> http://matplotlib.sourceforge.net/examples/pylab_examples/annotation_demo.html
> >
> http://matplotlib.sourceforge.net/examples/pylab_examples/annotation_demo2.html
>
> I already treated annotation, but I would like to give the readers (of
> the book) a much wider toolbox, so introducing bare arrows after
> annotations seems straigthforward.
Have you seen the arrow and fancy arrow demos
 http://matplotlib.sourceforge.net/examples/pylab_examples/arrow_demo.html
http://matplotlib.sourceforge.net/examples/pylab_examples/fancyarrow_demo.html
Both of these use older and less sophisticated arrows that JJ's
FancyArrowPatch
http://matplotlib.sourceforge.net/api/artist_api.html?highlight=fancyarrowpatch#matplotlib.patches.FancyArrowPatch
so perhaps the best thing for you to do would be to write an example using
the FancyArrowPatch directly.
JDH
From: John H. <jd...@gm...> - 2009年03月27日 13:13:48
2009年3月27日 Søren Nielsen <sor...@gm...>
> Hi,
>
> I can delete a line plot by removing the line object from axes.get_lines()
> .. but the limits are still saved.. so the axes is still autoscaled using so
> it includes the deleted line... Does anyone know how do I remove these
> limits? or update the data limits on the plotted data so that autoscale
> works again?
Use ax.relim()
http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.relim
JDH
From: John H. <jd...@gm...> - 2009年03月27日 12:58:41
On Fri, Mar 27, 2009 at 5:00 AM, marcusantonius <
mar...@st...> wrote:
>
> Hi,
>
> I have a problem when saving my plot as a png. The horizontal lines, which
> I
> inserted via
> axhline(y=0.136, xmin=0., xmax=1, color='black',ls=':')
> axhline(y=0.094, xmin=0., xmax=1, color='black',ls=':')
> are not displayed right in the png file. Saving in pdf works perfectly. I
> enclosed the two files in this email.
> http://www.nabble.com/file/p22738740/p25.pdf p25.pdf
> http://www.nabble.com/file/p22738740/p25.png p25.png
>
> Is there a way to fix this problem?
>
This appears to be working fine for me with svn matplotlib -- what version
are you using? See also:
http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#report-a-problemfor
information about how to obtain version and other configuration
information.
>
> Thank you for your help,
> Markus
> --
> View this message in context:
> http://www.nabble.com/Bug-when-saving-in-PNG--tp22738740p22738740.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: John H. <jd...@gm...> - 2009年03月27日 12:54:05
On Fri, Mar 27, 2009 at 7:30 AM, Bala subramanian <bal...@gm...
> wrote:
> Dear Friends,
>
> I am new to matplotlib. Just started with it. I have some queries, kindly
> help me to understand the following.
>
Welcome!
>
> i) How are pyplot and pylab are related. Is there any advantage of one over
> the other. In the matplotlib homepage examples are shown with both pyplot
> and pylab
>
See this FAQ:
http://matplotlib.sourceforge.net/faq/usage_faq.html#matplotlib-pylab-and-pyplot-how-are-they-related
>
> ii) How can i generage multi y-axes plot ie x y1 y2 y3 (with same x
> values). any small example script would be of much help to me.
>
plot([x,x,x], [y1, y2, y2], 'o')
See also this tutorial:
http://matplotlib.sourceforge.net/users/pyplot_tutorial.html
>
> iii) How to save the figure with a name. By default in which format the
> figure is saved ?
>
savefig('somefile.png') or savefig('somefile.pdf') etc. The extension
determines the file format. For details see
http://matplotlib.sourceforge.net/faq/installing_faq.html#backends
Hope this helps,
JDH
From: Bala s. <bal...@gm...> - 2009年03月27日 12:31:04
Dear Friends,
I am new to matplotlib. Just started with it. I have some queries, kindly
help me to understand the following.
i) How are pyplot and pylab are related. Is there any advantage of one over
the other. In the matplotlib homepage examples are shown with both pyplot
and pylab
ii) How can i generage multi y-axes plot ie x y1 y2 y3 (with same x values).
any small example script would be of much help to me.
iii) How to save the figure with a name. By default in which format the
figure is saved ?
Thanks in advance,
Bala
From: Søren N. <sor...@gm...> - 2009年03月27日 12:09:44
Hi,
I can delete a line plot by removing the line object from axes.get_lines()
.. but the limits are still saved.. so the axes is still autoscaled using so
it includes the deleted line... Does anyone know how do I remove these
limits? or update the data limits on the plotted data so that autoscale
works again?
Soren
From: marcusantonius <mar...@st...> - 2009年03月27日 10:00:36
Hi,
I have a problem when saving my plot as a png. The horizontal lines, which I
inserted via
axhline(y=0.136, xmin=0., xmax=1, color='black',ls=':')
axhline(y=0.094, xmin=0., xmax=1, color='black',ls=':')
are not displayed right in the png file. Saving in pdf works perfectly. I
enclosed the two files in this email.
http://www.nabble.com/file/p22738740/p25.pdf p25.pdf 
http://www.nabble.com/file/p22738740/p25.png p25.png 
Is there a way to fix this problem?
Thank you for your help,
Markus
-- 
View this message in context: http://www.nabble.com/Bug-when-saving-in-PNG--tp22738740p22738740.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: C M <cmp...@gm...> - 2009年03月27日 07:29:37
On Fri, Mar 27, 2009 at 1:56 AM, Eric Firing <ef...@ha...> wrote:
> C M wrote:
>>
>> Hi, I have just begun including the toolbar in an embedded (in wx)
>> use of mpl, and am really pleased with how easily it provides very
>> useful functions. Once again, mpl shines.
>>
>> But I would like to try to modify the toolbar for my application, e.g.
>> probably remove the "configure subplots" tool (n/a in my context)
>> and in fact add a number of my own application-specific tools to
>> that same toolbar.
>>
>> I didn't see any toolbar class within the widgets.py file in the
>> matplotlib directory. So, a) where can I find it, and b) is there
>> anything I should be aware of regarding modifying the toolbar?
>
> Toolbar functionality starts in backend_bases.py and continues in the
> individual toolkit-specific backends, like backends/backend_wx.py.
> Configurability has been on the wish list for a while.
>
> Have you looked at examples/user_interfaces/embedding_in_wx4.py? It does
> modify the default toolbar.
>
> Eric
Perfect, thank you.
Che
From: Eric F. <ef...@ha...> - 2009年03月27日 05:56:59
C M wrote:
> Hi, I have just begun including the toolbar in an embedded (in wx)
> use of mpl, and am really pleased with how easily it provides very
> useful functions. Once again, mpl shines.
> 
> But I would like to try to modify the toolbar for my application, e.g.
> probably remove the "configure subplots" tool (n/a in my context)
> and in fact add a number of my own application-specific tools to
> that same toolbar.
> 
> I didn't see any toolbar class within the widgets.py file in the
> matplotlib directory. So, a) where can I find it, and b) is there
> anything I should be aware of regarding modifying the toolbar?
Toolbar functionality starts in backend_bases.py and continues in the 
individual toolkit-specific backends, like backends/backend_wx.py. 
Configurability has been on the wish list for a while.
Have you looked at examples/user_interfaces/embedding_in_wx4.py? It 
does modify the default toolbar.
Eric
> 
> Thanks,
> Che
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: eliben <el...@gm...> - 2009年03月27日 05:43:22
Hello,
I have a demo application integrating a dynamic mpl plot into a PyQt GUI.
The plot is dynamic in the sense that the user can manipulate it through the
use of the GUI's (PyQt) widgets and controls. The code is in:
http://eli.thegreenplace.net/files/prog_code/qt_mpl_bars.py.txt
Now, I have a slight problem. When the plot is zoomed with the toolbar's
standard "zoom to rectangle" tool, and then the window is switched in an out
of focus, the zoom level disappears and the plot comes bac k to "home" mode. 
How can I make it persist? Can I somehow query the zoom state of the plot
and restore it?
Thanks
Eli
-- 
View this message in context: http://www.nabble.com/PyQt-integration-problem-with-the-Navigation-Toolbar-tp22736288p22736288.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: C M <cmp...@gm...> - 2009年03月27日 05:22:02
Hi, I have just begun including the toolbar in an embedded (in wx)
use of mpl, and am really pleased with how easily it provides very
useful functions. Once again, mpl shines.
But I would like to try to modify the toolbar for my application, e.g.
probably remove the "configure subplots" tool (n/a in my context)
and in fact add a number of my own application-specific tools to
that same toolbar.
I didn't see any toolbar class within the widgets.py file in the
matplotlib directory. So, a) where can I find it, and b) is there
anything I should be aware of regarding modifying the toolbar?
Thanks,
Che
From: John H. <jd...@gm...> - 2009年03月26日 19:29:15
On Thu, Mar 26, 2009 at 10:00 AM, Tyler B <bo...@gm...> wrote:
> Hi there,
>
> Thanks for your help with my problem yesterday.. the code was fine,
> and it was a problem with my system. I installed a fresh copy of EPD's
> Python and that fixed it!
>
> I have a quick question about making the chart background transparent.
>
> Here's the original graph: http://screencast.com/t/YuRZLOnmg
>
> Here's what i looks like when I use 'fig.frameon= False' :
> http://screencast.com/t/ZFkUFRoor
> (the gray part is transparent)
>
> So how do I make the last remaining white part transparent? I still
> want to keep the black axis, and just get rid of the white.
>
Have you seen
http://matplotlib.sourceforge.net/faq/howto_faq.html?highlight=codex%20transparent#save-transparent-figures
You can make the axes transparent with
 ax.patch.set_alpha(0.5)
or turn off the axes face entirely with
 ac.patch.set_facecolor('None')
Note the string 'None' is not the symbol None -- the latter means "use the
default face color"
JDH
From: Sandro T. <mo...@de...> - 2009年03月26日 17:20:57
Hello,
I'm trying to describe how to plot polar graphs with mpl, but the doc
for the above functions (in pyplot api page) is a bit "reduced".
For example, thetagrids() doc says it receive a fmt karg but calling
with it the error:
AttributeError: Unknown property fmt
is returned.
I'd like to know if there's a better place to have doc about those
functions, or if
there's an effort to improve it already planned.
Cheers,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
From: Tyler B <bo...@gm...> - 2009年03月26日 15:02:13
Hi there,
Thanks for your help with my problem yesterday.. the code was fine,
and it was a problem with my system. I installed a fresh copy of EPD's
Python and that fixed it!
I have a quick question about making the chart background transparent.
Here's the original graph: http://screencast.com/t/YuRZLOnmg
Here's what i looks like when I use 'fig.frameon= False' :
http://screencast.com/t/ZFkUFRoor
(the gray part is transparent)
So how do I make the last remaining white part transparent? I still
want to keep the black axis, and just get rid of the white.
Thanks!
Tyler
## Update the graph
r = mlab.csv2rec("gmail-count.txt", names='date,val1,val2',
 converterd={'date' : cbook.todatetime('%Y-%m-%d %H:%M:%S')})
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(r.date, r.val1, 'g-')
fig.autofmt_xdate ()
#fig.frameon= False
plt.savefig("gmail-graph.png")
From: Sandro T. <mo...@de...> - 2009年03月26日 15:00:21
Hi Jae-Joon,
thanks for the reply.
On Thu, Mar 26, 2009 at 02:51, Jae-Joon Lee <lee...@gm...> wrote:
> You need to adjust the keyword arguments, such as head_width, etc. The
But shouldn't the default arrow be a little bit "nicer" than it's now? :)
> arrow command itself is poorly documented and its keyword arguments
> are explained in
> matplitlib.patches.FancyArrow.
Ah, that's why even in pyploy.arrow() I could'nt find eny reference to
head_width & friends. In case I have some time to share on improve
arrow() docs, what docs should I look to? and changing
'doc/api/pyplot_api.rst' is the right place to achieve it?
> However, I recommend you to use
> annotate command instead of arrow (you can give empty string if you
> just need an arrow). For example,
>
> annotate("", (0.2, 0.2), (0.4, 0.4),
>        arrowprops=dict(arrowstyle="->"))
>
> more examples,
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/annotation_demo.html
> http://matplotlib.sourceforge.net/examples/pylab_examples/annotation_demo2.html
I already treated annotation, but I would like to give the readers (of
the book) a much wider toolbox, so introducing bare arrows after
annotations seems straigthforward.
> Annotate does not adjust the xlim and ylim of your axes for you, thus
> it is your responsibility.
Yep, already noticed :D
Cheers,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
From: C M <cmp...@gm...> - 2009年03月26日 05:19:03
Attachments: draggable_legend2.py
On Thu, Mar 26, 2009 at 12:19 AM, Jae-Joon Lee <lee...@gm...> wrote:
> Sorry, It's hard to track down what's wrong without actually running the code.
I really appreciate your patience.
> Change
>
> self.legend._loc = loc_in_norm_axes
>
> to
>
> self.legend._loc = tuple(loc_in_norm_axes)
>
> and see if it works.
>
That did it! Thank you.
> You need to call canvas.draw. However, it will draw whole figure
> again. If you're concerned about speed, you may consider to use blit
> method.
> http://matplotlib.sourceforge.net/examples/animation/animation_blit_wx.html
I'll look into it. For the time being, this is already a very good improvement.
Thanks so much for the help. For the archives, the working runnable
sample (if you have wxPython) is attached.
Che
From: Jae-Joon L. <lee...@gm...> - 2009年03月26日 04:19:07
Sorry, It's hard to track down what's wrong without actually running the code.
Change
 self.legend._loc = loc_in_norm_axes
to
 self.legend._loc = tuple(loc_in_norm_axes)
and see if it works.
You need to call canvas.draw. However, it will draw whole figure
again. If you're concerned about speed, you may consider to use blit
method.
http://matplotlib.sourceforge.net/examples/animation/animation_blit_wx.html
-JJ
On Wed, Mar 25, 2009 at 10:55 PM, C M <cmp...@gm...> wrote:
> On Wed, Mar 25, 2009 at 9:58 PM, Jae-Joon Lee <lee...@gm...> wrote:
>> Ah, my bad.
>>
>> Try
>>
>>  self.legend.parent.transAxes.inverted().transform_point(loc_in_canvas)
>>
>> legend.parent points to the parent axes.
>>
>> -JJ
>>
>
> That cleared up the error, thanks. But it is still not actually moving the
> legend. The coordinates are changing as you described it:
>
> loc position (JJ method) = [ 0.89354419 0.91002415]
> motion_event.x = 436
> motion_event.y = 349.0
> mouse moved x = 31
> mouse moved y = 3.0
> loc position (JJ method) = [ 0.90698505 0.91002415]
>
> but the legend doesn't move.
>
> I have tried to different ways of doing the draw method.
>
> 1. self.canvas.draw()
> That gives this error and does not move the legend:
> ValueError: The truth value of an array with more than one element is
> ambiguous. Use a.any() or a.all()
>
> 2. self.draw() (this is a method which draws the lines and legend
> originally in my class).
> That just does nothing, though the output is as shown above.
>
> What do I have to do to actually show the repositioned legend?
>
> Thanks for your patience,
> C
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: C M <cmp...@gm...> - 2009年03月26日 02:55:16
On Wed, Mar 25, 2009 at 9:58 PM, Jae-Joon Lee <lee...@gm...> wrote:
> Ah, my bad.
>
> Try
>
>  self.legend.parent.transAxes.inverted().transform_point(loc_in_canvas)
>
> legend.parent points to the parent axes.
>
> -JJ
>
That cleared up the error, thanks. But it is still not actually moving the
legend. The coordinates are changing as you described it:
loc position (JJ method) = [ 0.89354419 0.91002415]
motion_event.x = 436
motion_event.y = 349.0
mouse moved x = 31
mouse moved y = 3.0
loc position (JJ method) = [ 0.90698505 0.91002415]
but the legend doesn't move.
I have tried to different ways of doing the draw method.
1. self.canvas.draw()
That gives this error and does not move the legend:
ValueError: The truth value of an array with more than one element is
ambiguous. Use a.any() or a.all()
2. self.draw() (this is a method which draws the lines and legend
originally in my class).
That just does nothing, though the output is as shown above.
What do I have to do to actually show the repositioned legend?
Thanks for your patience,
C
From: Jae-Joon L. <lee...@gm...> - 2009年03月26日 01:58:40
Ah, my bad.
Try
 self.legend.parent.transAxes.inverted().transform_point(loc_in_canvas)
legend.parent points to the parent axes.
-JJ
On Wed, Mar 25, 2009 at 9:36 PM, C M <cmp...@gm...> wrote:
> On Wed, Mar 25, 2009 at 9:06 PM, Jae-Joon Lee <lee...@gm...> wrote:
>> As I said in my previous email, the _loc attribute of the legend need
>> to be in the normalized axes coordinate, i.e., the lower left corner
>> of the axes being (0,0) and the upper-right corner being (1,1). Thus,
>> it needs to be something like below.
>>
>> loc_in_canvas = self.legend_x + mouse_diff_x, self.legend_y + mouse_diff_y
>> loc_in_norm_axes =
>> self.legend.transAxes.inverted().transform_point(loc_in_canvas)
>> self.legend._loc = loc_in_norm_axes
>>
>> Note that it assumes that the parent of the legend is an Axes
>> instance, which I think is your case.
>> IHTH,
>>
>> -JJ
>
> Thanks, but I am getting this error now:
>
> AttributeError: 'Legend' object has no attribute 'transAxes'
>
> My legend is created this way:
>
> self.legend = self.subplot.legend(self.line_collections_list, ['1'],
> numpoints=1)
>
> And self.subplot is made this way:
>
> self.figure = Figure(None, dpi)
> self.subplot = self.figure.add_subplot(111)
>
> I thought self.subplot is an Axes instance. Is it not?
>
> Thank you,
> C
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Jae-Joon L. <lee...@gm...> - 2009年03月26日 01:51:51
You need to adjust the keyword arguments, such as head_width, etc. The
arrow command itself is poorly documented and its keyword arguments
are explained in
matplitlib.patches.FancyArrow. However, I recommend you to use
annotate command instead of arrow (you can give empty string if you
just need an arrow). For example,
annotate("", (0.2, 0.2), (0.4, 0.4),
 arrowprops=dict(arrowstyle="->"))
more examples,
http://matplotlib.sourceforge.net/examples/pylab_examples/annotation_demo.html
http://matplotlib.sourceforge.net/examples/pylab_examples/annotation_demo2.html
Annotate does not adjust the xlim and ylim of your axes for you, thus
it is your responsibility.
-JJ
On Wed, Mar 25, 2009 at 6:39 PM, Sandro Tosi <mo...@de...> wrote:
> Hello,
> I'm trying to use arrows but I'm a little stuck.
>
> In [1]: import matplotlib
>
> In [2]: matplotlib.__version__
> Out[2]: '0.98.5.3'
>
> First, simply
>
> import matplotlib.pyplot as plt
> plt.arrow(2,2,4,1)
>
> doesn't show anything, while at least a figure with an arrow in is
> expected (or it's by design?)
>
> Secondly, with this simple script:
>
> import matplotlib.pyplot as plt
> plt.plot(range(10))
> plt.arrow(2,2,4,1, linewidth=5)
> plt.arrow(3,3,1,4)
>
> the result is quite ugly :) Where is the arrow pointer (for example)?
>
> I hope I'm missing something, but even in examples like "usetex_demo"
> the arrows are drawn "by hand" :)
>
> Thanks,
> --
> Sandro Tosi (aka morph, morpheus, matrixhasu)
> My website: http://matrixhasu.altervista.org/
> Me at Debian: http://wiki.debian.org/SandroTosi
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: C M <cmp...@gm...> - 2009年03月26日 01:45:49
On Wed, Mar 25, 2009 at 9:06 PM, Jae-Joon Lee <lee...@gm...> wrote:
> As I said in my previous email, the _loc attribute of the legend need
> to be in the normalized axes coordinate, i.e., the lower left corner
> of the axes being (0,0) and the upper-right corner being (1,1). Thus,
> it needs to be something like below.
>
> loc_in_canvas = self.legend_x + mouse_diff_x, self.legend_y + mouse_diff_y
> loc_in_norm_axes =
> self.legend.transAxes.inverted().transform_point(loc_in_canvas)
> self.legend._loc = loc_in_norm_axes
>
> Note that it assumes that the parent of the legend is an Axes
> instance, which I think is your case.
> IHTH,
>
> -JJ
Thanks, but I am getting this error now:
AttributeError: 'Legend' object has no attribute 'transAxes'
My legend is created this way:
self.legend = self.subplot.legend(self.line_collections_list, ['1'],
numpoints=1)
And self.subplot is made this way:
self.figure = Figure(None, dpi)
self.subplot = self.figure.add_subplot(111)
I thought self.subplot is an Axes instance. Is it not?
Thank you,
C
15 messages has been excluded from this view by a project administrator.

Showing results of 394

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