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

Showing 19 results of 19

Zane Selvans wrote:
> Zane Selvans <zane@...> writes:
> 
>> I'm plotting a bunch of lines on a map. They're being colored 
>> according to the value of an attribute associated with the objects 
>> they represent, using a colormap. However, I also need to create a 
>> colorbar to act as a legend, describing what the colors of the lines 
>> means, in terms of values associated with that attribute.
>>
>> What's the easiest way to do that?
> 
> I've found the matplotlib.colorbar.ColorbarBase class... and have been able to
> use matplotlib.colorbar.make_axes() to create a somewhat acceptable set of axes
> into which I can put a colorbar constructed from the same colormap that I'm
> using to color the lines I'm plotting. However, I can't seem to get the tics
> and axes on the colorbar to correspond to the values associated with the colors
> - they only ever go from 0-1. I want them to go from, for instance, 0-180
> (degrees) in 20 or 30 degree intervals. It seemed like setting the keyword
> arguments in ColorbarBase(boundaries=[0,180]) or values=linspace(0,180,10) or
> something like that ought to have done the right thing... but no, and I don't
> see any documentation on how these keywords are supposed to be used, in the
> docstring or elsewhere... anyone know how they work?
You probably want to use the ColorbarBase.add_lines() method; you can 
get an example of its use for line contours in the Colorbar class, and 
an example of the result is in examples/pylab_examples/contour_demo.py.
Eric
From: Jeff W. <js...@fa...> - 2008年10月09日 23:07:47
Mathew Yeates wrote:
> Hi
> Are there any modules in matplotlib for coordinate transformations. In 
> particular, I want to go from geodetic to WGS-84.
>
> Thanks
> Mathew
>
> 
Mathew: The pyproj module is included in the basemap toolkit and can be 
accessed with
from mpl_toolkits.basemap import pyproj
To see how to use it look at the docs for the Proj class at 
http://pyproj.googlecode.com/svn/trunk/README.html.
If you don't want to install the whole Basemap toolkit (a 100 mb 
download) you can just install the pyproj module from
http://code.google.com/p/pyproj
-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: Mathew Y. <my...@jp...> - 2008年10月09日 23:00:11
Hi
Are there any modules in matplotlib for coordinate transformations. In 
particular, I want to go from geodetic to WGS-84.
Thanks
Mathew
John Hunter wrote:
> On Thu, Oct 9, 2008 at 2:40 PM, Zane Selvans <za...@id...> wrote:
>
> 
>> Hmm. I'll have a look at these. Jeff Whitaker suggested them for
>> something else too. I too often feel like I'm just hacking my way
>> around in Matplotlib, without understanding how it is actually
>> "supposed" to be used (i.e. how it was designed to work). Is there an
>> architectural overview floating around somewhere that I'm not aware of?
>> 
>
> Check out http://matplotlib.sourceforge.net/doc/html/users/artists.html
> and other docs at
> http://matplotlib.sourceforge.net/doc/html/index.html
> 
and basemap specific docs are at
http://matplotlib.sourceforge.net/basemap/doc/html
-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
On Thu, Oct 9, 2008 at 2:40 PM, Zane Selvans <za...@id...> wrote:
> Hmm. I'll have a look at these. Jeff Whitaker suggested them for
> something else too. I too often feel like I'm just hacking my way
> around in Matplotlib, without understanding how it is actually
> "supposed" to be used (i.e. how it was designed to work). Is there an
> architectural overview floating around somewhere that I'm not aware of?
Check out http://matplotlib.sourceforge.net/doc/html/users/artists.html
and other docs at
http://matplotlib.sourceforge.net/doc/html/index.html
On Oct 9, 2008, at 7:08 AM, Ryan May wrote:
> Zane Selvans wrote:
>> Zane Selvans <zane@...> writes:
>>
>>> I also need to create a
>>> colorbar to act as a legend, describing what the colors of the lines
>>> means, in terms of values associated with that attribute.
>>
>> I've found the matplotlib.colorbar.ColorbarBase class...
>> I want them to go from, for instance, 0-180
>> (degrees) in 20 or 30 degree intervals. It seemed like setting the 
>> keyword
>> arguments in ColorbarBase(boundaries=[0,180]) or 
>> values=linspace(0,180,10) or
>> something like that ought to have done the right thing... but no, 
>> and I don't
>> see any documentation on how these keywords are supposed to be 
>> used, in the
>> docstring or elsewhere... anyone know how they work?
>
> You need to pass an instance of a matplotlib.colors.Normalize to the
> constructure to ColorbarBase, as in:
>
> cbar = ColorbarBase(norm=Normalize(0, 180))
Ahhh. There we go.
> As far as colormapping lines, you can do this using a LineCollection 
> object.
Hmm. I'll have a look at these. Jeff Whitaker suggested them for 
something else too. I too often feel like I'm just hacking my way 
around in Matplotlib, without understanding how it is actually 
"supposed" to be used (i.e. how it was designed to work). Is there an 
architectural overview floating around somewhere that I'm not aware of?
Thanks for the help!
Zane
--
Zane Selvans
Amateur Earthling
za...@id...
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F
From: Jae-Joon L. <lee...@gm...> - 2008年10月09日 19:19:47
Although I think it is possible to calculate the bounding box of the
all legends automatically,
Here is a manual way.
from matplotlib.patches import Rectangle
l1.get_frame().set_visible(False) # make background frame of legends invisible
l2.get_frame().set_visible(False)
# make a large background frame
rect = Rectangle((0.05, 0.75), 0.3, 0.2, # adjust these values (in
normalized axes coordinate)
 fc="w", ec="k",
 transform=ax.transAxes, zorder=4)
ax.add_artist(rect)
I hope this help,
-JJ
On Thu, Oct 9, 2008 at 2:43 PM, José Alexandre Nalon <na...@te...> wrote:
> Hello,
>
> Em Thursday 09 October 2008 13:46:52 Jae-Joon Lee escreveu:
>> Meanwhile, you may try to make multiple legends as a posible workarounds.
>
> Thanks for your answer. That did the trick, and the figure
> looks more or less as I wanted. It would look exactly as I
> wanted if I could remove the border from the legends and
> draw a box around the legends. How could I do that?
>
> (I apologize if this seems trivial. I use matplotlib a lot,
> but standard functions always seem to do what I need, so I
> don't go deep in its behaviour).
>
> --
> José Alexandre Nalon
> na...@te...
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: José A. N. <na...@te...> - 2008年10月09日 18:44:04
Hello,
Em Thursday 09 October 2008 13:46:52 Jae-Joon Lee escreveu:
> Meanwhile, you may try to make multiple legends as a posible workarounds.
Thanks for your answer. That did the trick, and the figure
looks more or less as I wanted. It would look exactly as I
wanted if I could remove the border from the legends and
draw a box around the legends. How could I do that?
(I apologize if this seems trivial. I use matplotlib a lot,
but standard functions always seem to do what I need, so I
don't go deep in its behaviour).
-- 
José Alexandre Nalon
na...@te...
From: Xavier G. <xav...@gm...> - 2008年10月09日 18:06:23
Hi,
I can do everything I want with pylab (and even more :) ).
I'm only missing one thing:
I really would like to have one more option in imshow to get the pixel 
value of the pixel pointed by the cursor.
The backends are showing X qnd Y coordinates. It is fine but I need also 
to look at the pixels values (before dooing computations thanks to scipy).
I know how to get the pixels values but I do not know how to print them 
at the bottom right of the backend (on the same line as the X,Y pixel 
number).
Is there a way to do that using the tk backend for instance?
If there is a way, would you consider a new boolean option in imshow to 
trigger this new behavior (of course, the default must be 'false' to 
prevent us to brake things..)
Any comment would be very much appreciated :)
Xavier
From: Anthony F. <ant...@co...> - 2008年10月09日 17:56:18
Hi Sebastien,
Sorry, I had forgotten about that. I've taken a look at the code that we have ... and it doesn't separate out nearly as much as I had thought. The code that rebuilds the plots is actually pretty complicated and messy ... not so much from a conceptual point of view but in how it was implemented. Plus, our data structure and corresponding plot structure is very nested: we have a the concept of series in series groups, which are on plots, which are in plot groups, and so on up to a few levels of grouping. Additionally, our plots allow for up to 4 'y' axes and 2 'x' axes, making the code seem more complicated than it is.
When we want to store the plots, we pickle the top object (which we call our plot manager) and because of the tree-like data structure, it pickles everything right down to the data in the series. We've been very careful to ensure that there are no mpl objects referenced in the data structure.
When we unpickle the plot manager, we walk our way through the tree, calling plotPanel.addPlot(...) and plotPanel.addSeries(...) as we go. In this case, plotPanel is a class that is a wx.Frame (well, an MDI frame in our case) that has a mpl figure on it, and various methods that know how to manipulate the data from our Plot and Series objects to create appropriate mpl analogues. This is strictly a one-way operation: we always build plots and series from our own objects and any modifications occur on our objects and not on the mpl lines/figures/etc. That is, if we want to change a series colour for example, the code modifies our Series object and it emits a pubsub message that causes the plotPanel to update itself based on what's in the Series object ... we never manipulate the mpl line directly.
At any rate, I've attached some code to this email which illustrates what I was talking about, but it's not runnable and it references other files which I haven't included. Still you should be able to get the idea.
Hope this helps,
Anthony.
> -----Original Message-----
> From: Sebastien Binet [mailto:bi...@ce...] 
> Sent: October 8, 2008 9:47 PM
> To: Anthony Floyd
> Cc: Anthony Floyd
> Subject: Re: [Matplotlib-users] save or pickle figure object
> 
> Hi Anthony,
> 
> On Tuesday 16 September 2008 20:30:26 Anthony Floyd wrote:
> > On Tue, Sep 16, 2008 at 8:17 PM, Sebastien Binet
> >
> > <hep...@gm...> wrote:
> > > Hi Anthony,
> > >
> > >> As you've already been told, you can't pickle/shelve mpl 
> objects. Our
> > >> solution to this is to have a native python shadow object that
> > >> contains all the bits and pieces needed to create a 
> figure, and always
> > >> build the plots from these shadow objects. This gives us the
> > >> advantage of being able to shelve the shadow objects and 
> rebuild the
> > >> figures later.
> > >
> > > this is rather interesting !
> > > any code to point to ?
> >
> > Hi Sebastien,
> >
> > I'll see what I can extract from the code tomorrow at work. It's
> > pretty modular so I should be able to point to something.
> 
> any news about this ?
> 
> cheers,
> sebastien.
> -- 
> ###################################
> # Dr. Sebastien Binet
> # Lawrence Berkeley National Lab.
> # 1 Cyclotron Road
> # Berkeley, CA 94720
> ###################################
> 
> 
From: Jae-Joon L. <lee...@gm...> - 2008年10月09日 16:46:58
The current legend class does not support multiple columns.
Eric Wertman once mentioned in this list that he would work on this
feature, but I don't know the current status.
A (partial) rewrite of the legend class which I plan to support
multicolumns is in my TODO list but I haven't started it yet.
Meanwhile, you may try to make multiple legends as a posible workarounds.
For example, following code plots 10 lines and make two legends, each
with 5 lines, one at upper left and one at upper right.
ax = gca()
pl_list = []
for i in range(10):
 pl, = ax.plot(random(10))
 pl_list.append(pl)
from matplotlib.legend import Legend
l1 = Legend(ax, pl_list[:5], "01234", loc=2)
l2 = Legend(ax, pl_list[5:], "56789", loc=1)
#l1 = Legend(ax, pl_list[:5], "01234", loc=(0.02, 0.72))
#l2 = Legend(ax, pl_list[5:], "56789", loc=(0.2, 0.72))
ax.add_artist(l1)
ax.add_artist(l2)
draw()
You may manually adjust the legend position to place the legends side
by side (see the commented lines), but it would be somewhat tricky if
you need 4 columns.
-JJ
On Thu, Oct 9, 2008 at 10:50 AM, José Alexandre Nalon
<na...@te...> wrote:
> Hello,
>
> Is there an easy way to make a legend with multiple lines
> and columns? I need 8 plots in the same figure, and the
> legend takes a lot of space. I believe that if I could
> orient the legend in multiple lines and columns (say, 2
> lines with four columns each), I could save a lot of
> space, giving more room to the plots. Any other suggestion
> would be useful. Thanks in advance.
>
> --
> José Alexandre Nalon
> na...@te...
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: José A. N. <na...@te...> - 2008年10月09日 15:12:15
Hello,
Is there an easy way to make a legend with multiple lines
and columns? I need 8 plots in the same figure, and the
legend takes a lot of space. I believe that if I could
orient the legend in multiple lines and columns (say, 2
lines with four columns each), I could save a lot of
space, giving more room to the plots. Any other suggestion
would be useful. Thanks in advance.
-- 
José Alexandre Nalon
na...@te...
Zane Selvans wrote:
> Zane Selvans <zane@...> writes:
> 
>> I'm plotting a bunch of lines on a map. They're being colored 
>> according to the value of an attribute associated with the objects 
>> they represent, using a colormap. However, I also need to create a 
>> colorbar to act as a legend, describing what the colors of the lines 
>> means, in terms of values associated with that attribute.
>>
>> What's the easiest way to do that?
> 
> I've found the matplotlib.colorbar.ColorbarBase class... and have been able to
> use matplotlib.colorbar.make_axes() to create a somewhat acceptable set of axes
> into which I can put a colorbar constructed from the same colormap that I'm
> using to color the lines I'm plotting. However, I can't seem to get the tics
> and axes on the colorbar to correspond to the values associated with the colors
> - they only ever go from 0-1. I want them to go from, for instance, 0-180
> (degrees) in 20 or 30 degree intervals. It seemed like setting the keyword
> arguments in ColorbarBase(boundaries=[0,180]) or values=linspace(0,180,10) or
> something like that ought to have done the right thing... but no, and I don't
> see any documentation on how these keywords are supposed to be used, in the
> docstring or elsewhere... anyone know how they work?
You need to pass an instance of a matplotlib.colors.Normalize to the
constructure to ColorbarBase, as in:
cbar = ColorbarBase(norm=Normalize(0, 180))
As far as colormapping lines, you can do this using a LineCollection object.
Hope this helps,
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: John H. <jd...@gm...> - 2008年10月09日 13:04:34
On Thu, Oct 9, 2008 at 5:12 AM, Michael <mna...@bl...> wrote:
> I don't what is optimum, matplotlib has always been a bit hackish for
> animation i think
Calling cla or clf in the animation loop is probably always a bad
idea, because of the flashing you have noticed. Trying to use a simple
python loop called from the main level doesn't play nicely with the
GUI event loop and will fail in most cases.
I have written all of the animation examples in the
matplotlib/examples/animation directory to avoid a main level python
loop. Ideally, you should use your GUI idle handler to trigger the
animation update.
 http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/examples/animation/
I have spent some time trying to abstract this across the different
GUIs we support to make this easier on users, but have been stymied...
JDH
From: John H. <jd...@gm...> - 2008年10月09日 12:47:20
On Tue, Oct 7, 2008 at 8:10 AM, Alexander Borghgraef
<ale...@gm...> wrote:
> I'm trying to figure out how to do animated graphics in pylab using
> imshow, so I made this little 'hello world' equivalent showing a
> moving square over two frames.
> Problem is I have to call draw twice to refresh the image. Anyone can
> explain why this is so (and how to do this more elegantly)? This is
> the code:
I do not see this problem using svn HEAD (the first draw after setting
the frame2 data shows the frame2 image).
There are a couple examples showing how to do animation for images in
the mpl examples dir -- see attached
From: Alexander B. <ale...@gm...> - 2008年10月09日 12:38:36
On Wed, Oct 8, 2008 at 12:23 AM, Michael <mna...@bl...> wrote:
> loop through the data and call clf():
>
> from pylab import *
> from numpy import *
>
> ion()
> hold(False)
>
> frame1 = zeros((200, 200))
> frame1[20:40, 20:40] = 255
>
> frame2 = zeros((200, 200))
> frame2[20:40, 30:50] = 255
>
> frame3 = zeros((200, 200))
> frame3[20:40, 40:60] = 255
>
> frame4 = zeros((200, 200))
> frame4[20:40, 50:70] = 255
>
> frame5 = zeros((200, 200))
> frame5[20:40, 50:70] = 255
>
> data=[frame1,frame2,frame3,frame4,frame5]
>
> for frame in data:
> m=imshow(frame)
> m.set_data(frame)
> clf()
> show()
> #close()
If you do this, you can skip the set_data call, it works quite well
without it. Blinks horribly though.
-- 
Alex Borghgraef
From: Michael <mna...@bl...> - 2008年10月09日 10:13:44
On Thu, 2008年10月09日 at 03:15 +0000,
mat...@li... wrote:
> Message: 8
> Date: 2008年10月08日 17:05:46 -0400
> From: Alan G Isaac <ai...@am...>
> Subject: Re: [Matplotlib-users] Animation and imshow
> To: Matplotlib Users <mat...@li...>
> Message-ID: <48E...@am...>
> Content-Type: text/plain; charset=UTF-8; format=flowed
> 
> On 10/7/2008 6:23 PM Michael apparently wrote:
> > loop through the data and call clf():
> 
if the confusion is over my signature, i still sign using a gpg key
registered to a different email account
> The clf call seems quite wrong:
> it flashes horribly and I get good
> behavior without it (once I add
> a call to sleep). What am I
> missing?
afaik it doesn't look like there's anything missing
if anything there is some superfluous code:
fig1 = plt.figure(1)
ax1 = fig1.gca()
and the animated=True kwarg
I don't what is optimum, matplotlib has always been a bit hackish for
animation i think
best
Michael Nandris
> 
> 
> Alan Isaac
> 
> PS The following almost works (i.e., works,
> but then exits with an error).
> 
> import matplotlib.pyplot as plt
> from time import sleep
> from numpy import zeros
> 
> plt.ion()
> plt.hold(False)
> 
> data = list()
> slices = list()
> for i in range(5):
> frame = zeros( (200,200) )
> frame[20:40,10*i:10*i+20] = 255
> data.append(frame)
> 
> fig1 = plt.figure(1)
> ax1 = fig1.gca()
> for frame in data:
> plt.imshow(frame, axes=ax1, animated=True)
> sleep(0.2)
-- 
"When you think of the long and gloomy history of man, you will find far
more hideous crimes have been committed in the name of obedience than
have been committed in the name of rebellion". C.P.Snow,
"Either-Or" (1961)
Zane Selvans <zane@...> writes:
> 
> I'm plotting a bunch of lines on a map. They're being colored 
> according to the value of an attribute associated with the objects 
> they represent, using a colormap. However, I also need to create a 
> colorbar to act as a legend, describing what the colors of the lines 
> means, in terms of values associated with that attribute.
> 
> What's the easiest way to do that?
I've found the matplotlib.colorbar.ColorbarBase class... and have been able to
use matplotlib.colorbar.make_axes() to create a somewhat acceptable set of axes
into which I can put a colorbar constructed from the same colormap that I'm
using to color the lines I'm plotting. However, I can't seem to get the tics
and axes on the colorbar to correspond to the values associated with the colors
- they only ever go from 0-1. I want them to go from, for instance, 0-180
(degrees) in 20 or 30 degree intervals. It seemed like setting the keyword
arguments in ColorbarBase(boundaries=[0,180]) or values=linspace(0,180,10) or
something like that ought to have done the right thing... but no, and I don't
see any documentation on how these keywords are supposed to be used, in the
docstring or elsewhere... anyone know how they work?
I'm plotting a bunch of lines on a map. They're being colored 
according to the value of an attribute associated with the objects 
they represent, using a colormap. However, I also need to create a 
colorbar to act as a legend, describing what the colors of the lines 
means, in terms of values associated with that attribute.
What's the easiest way to do that?
I know what the upper and lower bounds of the values that need to be 
represented in the colorbar are, but I don't see any way to just slap 
a generic colorbar on the figure and give it some tick marks 
corresponding to the values I know the colors represent.
I have a list of all the Line2D objects in the map, but I can't pass 
them to colorbar() as the 'mappable' parameter without getting:
AttributeError: 'Line2D' object has no attribute 'autoscale_None'
It seems like this is something that should be trivially easy, but I 
don't see how to do it in the documentation anywhere.
Thanks for any insight you might have...
Zane
--
Zane Selvans
Amateur Earthling
za...@id...
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F

Showing 19 results of 19

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





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

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

More information about our ad policies

Ad destination/click URL:

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