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





Showing 10 results of 10

From: Jarrod M. <mi...@be...> - 2011年10月28日 17:43:42
==========================
SciPy 2011 Call for Papers
==========================
The third `SciPy India Conference <http://scipy.in>`_ will be held
from December 4th through the 7th at the `Indian Institute of
Technology, Bombay (IITB) <http://www.iitb.ac.in/>`_ in Mumbai,
Maharashtra India.
At this conference, novel applications and breakthroughs made in the
pursuit of science using Python are presented. Attended by leading
figures from both academia and industry, it is an excellent
opportunity to experience the cutting edge of scientific software
development.
The conference is followed by two days of tutorials and a code sprint,
during which community experts provide training on several scientific
Python packages.
We invite you to take part by submitting a talk abstract on the
conference website at:
http://scipy.in
Talk/Paper Submission
==========================
We solicit talks and accompanying papers (either formal academic or
magazine-style articles) that discuss topics regarding scientific
computing using Python, including applications, teaching, development
and research. We welcome contributions from academia as well as
industry.
Important Dates
==========================
November 2, 2011, Wednesday: Abstracts Due
November 7, 2011, Monday: Schedule announced
November 28, 2011, Monday: Proceedings paper submission due
December 4-5, 2011, Sunday-Monday: Conference
December 6-7 2011, Tuesday-Wednesday: Tutorials/Sprints
Organizers
==========================
* Jarrod Millman, Neuroscience Institute, UC Berkeley, USA (Conference Co-Chair)
* Prabhu Ramachandran, Department of Aerospace Engineering, IIT
Bombay, India (Conference Co-Chair)
* FOSSEE Team
From: Sterling S. <sm...@fu...> - 2011年10月28日 17:14:29
> From: John Hunter <jd...@gm...>
> Date: October 28, 2011 5:54:36 AM PDT
> To: Adam Mercer <ram...@gm...>
> Cc: mat...@li...
> Subject: Re: [Matplotlib-users] Legend and proxy artists
> 
> 
> On Thu, Oct 27, 2011 at 8:12 AM, Adam Mercer <ram...@gm...> wrote:
>> value_plot = []
>> for v in value:
>> value_plot.append(value_axes.plot_date(w[:,0], w[:,1], 'ro-', ms=4))
>> 
>> # legend
>> date_axes.legend(([morning_plot], [evening_plot], [value_plot]),
>> ("Morning", "Evening", "Value"),
>> numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True)
>> 
>> # save plot
>> fig.savefig(plot_file)
> 
> Your problem is that value_plot is a list of lists, and not a list of
> lines. ax.plot_date returns a list of lines, so you need to do
> 
> value_plot.extend(value_axes.plot_date(w[:,0], w[:,1], 'ro-', ms=4))
This by itself does not solve the problem. The call to legend needs a list of handles (artists) and a list of labels. If using the line JDH suggested, try
date_axes.legend((morning_plot[0], evening_plot[0], value_plot[0]),
 ("Morning", "Evening", "Value"),
 numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True)
With the code as it is try
date_axes.legend((morning_plot[0], evening_plot[0], value_plot[0][0]),
 ("Morning", "Evening", "Value"),
 numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True)
If neither works, then you might need to provide more information.
-Sterling
From: Benjamin R. <ben...@ou...> - 2011年10月28日 17:00:08
On Fri, Oct 28, 2011 at 11:47 AM, Gousios George <gg...@wi...>wrote:
> Hello , i wanted to ask how can i do what i am saying in title.
>
> I have a plot with some points and i have a circle.
> I want to combine both data in one plot.(a circle and point data)
>
> I can't do it because ( i think) for the circle i use pylab.show() but
> for plot ,just show().
> Is there another way to make the circle?
>
> > from scitools.std import *
> > import pylab
> >
> >
> > npoints=10
> >
> > vectorpoint=random.uniform(-1,1,[1,2])
> > experiment=random.uniform(-1,1,[npoints,2])
> >
> > #plot(experiment[:,0],experiment[:,1],'ro')
> > #show()
> >
> > plot(experiment[:,0],experiment[:,1],'ro')
> > hold('on')
> > circ = pylab.Circle((0., 0.), 1.0,alpha=0.1)
> > pylab.gca().add_patch(circ)
> > pylab.axis('scaled')
> > pylab.show()
>
> Thanks!
>
>
try this:
pylab.plot(experiment[:, 0], experiment[:, 1], 'ro')
circ = pylab.Circle((0., 0.), 1.0, alpha=0.1)
pylab.gca().add_patch(circ)
pylab.axis('scaled')
pylab.show()
Cheers!
Ben Root
>
>
> ------------------------------------------------------------------------------
> The demand for IT networking professionals continues to grow, and the
> demand for specialized networking skills is growing even more rapidly.
> Take a complimentary Learning@Cisco Self-Assessment and learn
> about Cisco certifications, training, and career opportunities.
> http://p.sf.net/sfu/cisco-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Gousios G. <gg...@wi...> - 2011年10月28日 16:48:07
Hello , i wanted to ask how can i do what i am saying in title.
I have a plot with some points and i have a circle.
I want to combine both data in one plot.(a circle and point data)
I can't do it because ( i think) for the circle i use pylab.show() but 
for plot ,just show().
Is there another way to make the circle?
> from scitools.std import *
> import pylab
>
>
> npoints=10
>
> vectorpoint=random.uniform(-1,1,[1,2])
> experiment=random.uniform(-1,1,[npoints,2])
>
> #plot(experiment[:,0],experiment[:,1],'ro')
> #show()
>
> plot(experiment[:,0],experiment[:,1],'ro')
> hold('on')
> circ = pylab.Circle((0., 0.), 1.0,alpha=0.1)
> pylab.gca().add_patch(circ)
> pylab.axis('scaled')
> pylab.show()
Thanks!
From: Justin M. <jn...@gm...> - 2011年10月28日 13:48:04
On Fri, Oct 28, 2011 at 6:31 AM, Paul Hilscher <pph...@gm...> wrote:
> Dear all,
> first of all thank you for the this awesome plotting library :D.
> I have a logarithmic plot where I want to stress out a specific range using
> a line like
> y  Something
> |  |-------------------|
> |  ___________
> | /          \
> | /           \
> |/
> |--------------------------->
>      x
> I looked up the documentation but could find a proper arrow style or
> similar.
> Does anybody know how to do this the proper way ?
> I did that "manualy" using 3 plot commands and text() , but I guess there
> should be some nicer way ??
You can create the arrow with
 a = mpl.patches.FancyArrowPatch(posA=(4,4), posB=(7,4), arrowstyle="|-|")
 ax.add_patch(a)
or
 ax.annotate("", xy=(4,4), xytext=(7,4), arrowprops=dict(arrowstyle='|-|'))
and then adding your label manually with text(), like you said. There
may be some way to do it all in the annotate command (by shifting the
arrow away from the label somehow), but by default the annotate()
command draws an arrow from point xytext to xy (the point you're
labeling).
 Justin
From: John H. <jd...@gm...> - 2011年10月28日 12:55:09
On Thu, Oct 27, 2011 at 8:12 AM, Adam Mercer <ram...@gm...> wrote:
> Hi
>
> I have recently updated to Matplotlib-1.1.0 and now one of my scripts
> displays the following warning:
>
> UserWarning: Legend does not support [[<matplotlib.lines.Line2D object
> at 0x1026296d0>]]
> Use proxy artist instead.
>
> http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
>
> The link it refers to doesn't seem to be much help, and I can't see
> what I need to do in order to correctly display the legend. Below is
> the appropriate plotting section of my script, could anyone offer
> suggestions as to how to correctly display the legend?
>
> # plot size, scale by golden ratio
> fig = pyplot.figure()
> fig.set_size_inches(10, 10 / ((1 + math.sqrt(5)) / 2))
> date_axes = fig.add_subplot(111)
>
> # setup secondary axes
> value_axes = date_axes.twinx()
>
> # set plot labels
> date_axes.set_xlabel("Date")
> date_axes.set_ylabel("Time")
> value_axes.set_ylabel("Value")
>
> # produce plot
> morning_plot = date_axes.plot_date(morning[:,0], morning[:,1], 'bo-', ms=4)
> evening_plot = date_axes.plot_date(evening[:,0], evening[:,1], 'go-', ms=4)
> value_plot = []
> for v in value:
> value_plot.append(value_axes.plot_date(w[:,0], w[:,1], 'ro-', ms=4))
>
> # legend
> date_axes.legend(([morning_plot], [evening_plot], [value_plot]),
>  ("Morning", "Evening", "Value"),
>  numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True)
>
> # save plot
> fig.savefig(plot_file)
Your problem is that value_plot is a list of lists, and not a list of
lines. ax.plot_date returns a list of lines, so you need to do
 value_plot.extend(value_axes.plot_date(w[:,0], w[:,1], 'ro-', ms=4))
rather than calling "append".
The legend method expects a list of matplotlib artists, not a list of lists.
JDH
From: Paul H. <pph...@gm...> - 2011年10月28日 10:31:17
Dear all,
first of all thank you for the this awesome plotting library :D.
I have a logarithmic plot where I want to stress out a specific range using
a line like
y Something
| |-------------------|
| ___________
| / \
| / \
|/
|--------------------------->
 x
I looked up the documentation but could find a proper arrow style or
similar.
Does anybody know how to do this the proper way ?
I did that "manualy" using 3 plot commands and text() , but I guess there
should be some nicer way ??
Thanks a lot for help and best wishes,
Paul Hilscher
From: Adam M. <ram...@gm...> - 2011年10月28日 06:22:59
On Fri, Oct 28, 2011 at 00:56, Sterling Smith <sm...@fu...> wrote:
> Here is a working example:
>
> from pylab import figure, arange
> fig = figure(1)
> fig.clear()
> ax = fig.add_subplot(111)
> x = arange(0,1,.25)
> y1 = x
> y2 = x**2
> y3 = x**3
> l1 = ax.plot(x,y1,'bo-')
> l2 = ax.plot(x,y2,'go-')
> l3 = []
> for xi,x1 in enumerate(x):
> l3.append(ax.plot(x1,y3[xi],'ro-'))
> print l1,l2,l3
> leg = ax.legend((l1[0],l2[0],l3[0][0]),('$x$','$x^2$','$x^3$'),
> numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True)
OK, you're example works but trying to modify my code is resulting in
the same errors. But it's late so that's a job for tomorrow...
> Note that when l1 and l2 are printed that they are 1-element lists, and l3 is a list of 1-element lists, all of which are not the type of handles that legend is looking for. Furthermore, in your code, you are trying to embed these lists in yet another layer of list.
Thanks, this is starting to make sense...
> If your code worked as it was with previous versions of matplotlib, then maybe someone with more knowledge could explain what changed to not allow your code to work now (it may be related to https://github.com/matplotlib/matplotlib/pull/534).
It worked without issue with matplotlib-1.0.1.
Cheers
Adam
From: Sterling S. <sm...@fu...> - 2011年10月28日 05:56:31
Adam,
I'm sorry that I wasn't clear before.
Here is a working example:
from pylab import figure, arange
fig = figure(1)
fig.clear()
ax = fig.add_subplot(111)
x = arange(0,1,.25)
y1 = x
y2 = x**2
y3 = x**3
l1 = ax.plot(x,y1,'bo-')
l2 = ax.plot(x,y2,'go-')
l3 = []
for xi,x1 in enumerate(x):
 l3.append(ax.plot(x1,y3[xi],'ro-'))
print l1,l2,l3
leg = ax.legend((l1[0],l2[0],l3[0][0]),('$x$','$x^2$','$x^3$'),
 numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True)
Note that when l1 and l2 are printed that they are 1-element lists, and l3 is a list of 1-element lists, all of which are not the type of handles that legend is looking for. Furthermore, in your code, you are trying to embed these lists in yet another layer of list. 
If your code worked as it was with previous versions of matplotlib, then maybe someone with more knowledge could explain what changed to not allow your code to work now (it may be related to https://github.com/matplotlib/matplotlib/pull/534).
-Sterling
On Oct 27, 2011, at 8:32PM, Adam Mercer wrote:
> On Thu, Oct 27, 2011 at 12:05, Sterling Smith <sm...@fu...> wrote:
> 
>> Your example is not complete. I don't understand the value variable that you are iterating over, or how it affects the different plots you are making.
> 
> value is simply a list of different datasets to plot, read in using:
> 
> value = []
> for v_file in glob.glob(value_glob):
> value.append(numpy.atleast_2d(numpy.loadtxt(v_file, converters={0:
> dates.datestr2num})))
> 
> where value_glob specifies a glob pattern of files to read in.
> 
>> I would guess that the problem is that you have a list of tuples of handles for value_plot, instead of a list of handles. Note that each of the plot_date commands returns a length=1 tuple of lines. So you should pick out the first item of each tuple, and you probably only need the 1st item of the value_plot list, since you only give 3 labels.
> 
> I'm not really following you, do you mean something like the following:
> 
> # legend
> date_axes.legend(([morning_plot], [evening_plot], [value_plot[0]]),
> ("Morning", "Evening", "Value"),
> numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True)
> 
> as that results in the same errors?
> 
> Cheers
> 
> Adam
From: Adam M. <ram...@gm...> - 2011年10月28日 03:33:32
On Thu, Oct 27, 2011 at 12:05, Sterling Smith <sm...@fu...> wrote:
> Your example is not complete. I don't understand the value variable that you are iterating over, or how it affects the different plots you are making.
value is simply a list of different datasets to plot, read in using:
value = []
for v_file in glob.glob(value_glob):
 value.append(numpy.atleast_2d(numpy.loadtxt(v_file, converters={0:
dates.datestr2num})))
where value_glob specifies a glob pattern of files to read in.
> I would guess that the problem is that you have a list of tuples of handles for value_plot, instead of a list of handles. Note that each of the plot_date commands returns a length=1 tuple of lines. So you should pick out the first item of each tuple, and you probably only need the 1st item of the value_plot list, since you only give 3 labels.
I'm not really following you, do you mean something like the following:
# legend
date_axes.legend(([morning_plot], [evening_plot], [value_plot[0]]),
 ("Morning", "Evening", "Value"),
 numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True)
as that results in the same errors?
Cheers
Adam

Showing 10 results of 10

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