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
(1) |
2
(4) |
3
(12) |
|
4
(5) |
5
(30) |
6
(21) |
7
(20) |
8
(11) |
9
(9) |
10
(12) |
|
11
(11) |
12
(22) |
13
(22) |
14
(38) |
15
(25) |
16
(23) |
17
(20) |
|
18
(7) |
19
(13) |
20
(13) |
21
(18) |
22
(6) |
23
(7) |
24
(4) |
|
25
(9) |
26
(35) |
27
(37) |
28
(22) |
29
(27) |
30
(12) |
31
(4) |
|
From: Adam M. <ram...@gm...> - 2009-01-17 23:25:13
|
On Sat, Jan 17, 2009 at 17:19, Adam Mercer <ram...@gm...> wrote: > Hi > > I'm trying to track down an issue with the CocoaAgg backend on Mac OS > X using MacPorts, when run with the CocoaAgg backend the following > code: Sorry, should have mentioned that this is with Matplotlib-0.98.5.2 using Mac OS X Leopard. Cheers Adam |
|
From: Adam M. <ram...@gm...> - 2009-01-17 23:19:17
|
Hi
I'm trying to track down an issue with the CocoaAgg backend on Mac OS
X using MacPorts, when run with the CocoaAgg backend the following
code:
from pylab import *
import time
ion()
tstart = time.time()
x = arange(0,2*pi,0.01)
line, = plot(x,sin(x))
for i in arange(1,200):
line.set_ydata(sin(x+i/10.0))
draw()
print 'FPS:' , 200/(time.time()-tstart)
fails with the backtrace:
$ python temp.py -dCocoaAgg
Traceback (most recent call last):
File "temp.py", line 2, in <module>
from pylab import *
File "/opt/local/lib/python2.5/site-packages/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "/opt/local/lib/python2.5/site-packages/matplotlib/pylab.py",
line 253, in <module>
from matplotlib.pyplot import *
File "/opt/local/lib/python2.5/site-packages/matplotlib/pyplot.py",
line 75, in <module>
new_figure_manager, draw_if_interactive, show = pylab_setup()
File "/opt/local/lib/python2.5/site-packages/matplotlib/backends/__init__.py",
line 25, in pylab_setup
globals(),locals(),[backend_name])
File "/opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_cocoaagg.py",
line 54, in <module>
class FigureCanvasCocoaAgg(FigureCanvasAgg):
File "/opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_cocoaagg.py",
line 63, in FigureCanvasCocoaAgg
start_event_loop.__doc__=FigureCanvasBase.start_event_loop_default.__doc__
NameError: name 'FigureCanvasBase' is not defined
However this runs without issue using the MacOSX backend:
$ python temp.py -dMacOSX
FPS: 20.1183278689
Is there some missing dependency that could cause this?
Cheers
Adam
|
|
From: Pierre GM <pgm...@gm...> - 2009-01-17 20:11:52
|
Anton, You may wanna check on the numpy list as well. I recently reimplemented a function to read text file as a combination of numpy.loadtxt and mlab.csv2rec, that handles missing data nicely. You can get it here for the moment: https://code.launchpad.net/~pierregm/numpy/numpy_addons The function you would need is mafromtxt, in fromascii. Alternatively, you can try using the scikits.timeseries package (http://pytseries.sourceforge.net/ ): recent SVN versions introduced tsfromtxt, that read a text file and return a timeseries. However, none of these possibilities will work out-of-the-box, because of the presence of the footer. What you could do is write a first function that gets rid of this footer (example of MO: open the file, read all the lines in a list, get rid of the first 7 rows (header) and last 8 ones, store the result in a file). Once you have only the data, use mafromtxt (for example) using space as a delimiter, and specify the columns you want to use with usecols (that way, you can get rid of the column with the '*'). The missing data should be taken into account properly. Let me know how it goes. P. On Jan 17, 2009, at 2:16 AM, antonv wrote: > > Dear all, > > I know this is not related to matplotlib but this seems to be the > only place > where I found people that have knowledge of both NOAA data and > python so > please bear with me. > > The .bull file that NOAA gives for upload is an ascii file formatted > for > human readability but it creates a lot of issues when I am trying to > parse > it. Here is a link to one of these files: > > ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/wave/prod/wave.20090117/bulls.t00z/akw.46001.bull > > Do you have any idea on how to extract the data there in columns for > plotting with matplotlib? If you look at the file you'll notice that > there > is both a header and a footer for the file that needs to be > eliminated and > the main columns have sub columns also. Another issue is that in a > column > there is missing data that should keep it's relationship with the time > column. And the last issue, some of the values there are preceded by > a "*" > sign that should just be removed too. > > Any ideas are greatly appreciated! > > Anton > > -- > View this message in context: http://www.nabble.com/NOAA-.bull-file-parsing-tp21513800p21513800.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: John H. <jd...@gm...> - 2009-01-17 12:50:37
|
On Fri, Jan 16, 2009 at 10:34 PM, Eric Firing <ef...@ha...> wrote: > antonv wrote: >> Thanks for the quick reply John! Now it makes a lot more sense. The next dumb >> question is what is SVN and where can I find more bout it? > > http://sourceforge.net/svn/?group_id=80706 > http://subversion.tigris.org/ See also http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-svn JDH |
|
From: David T. <dl...@ca...> - 2009-01-17 12:28:12
|
Managed to solve the problem now. David David Trethewey wrote: > I think I realised what I was doing wrong, I didn't have the imshow() > call beforehand in my program: > > But using the code: > > cax = fig.add_axes([0.85, 0.1, 0.075, 0.8]) > a=outer(arange(0,1,0.01),ones(10)) > imshow(a,aspect='auto',cmap=cm.gray,origin='lower') > > I get a set of axes from 0 to 10 in the x direction and 0 to 100 in > y.How do I get rid of the x axis and scale the y axis from 0 to 1. > > David > > David Trethewey wrote: > >> I've been trying to add a colorbar to my figure and have used the >> following code; >> >> cax = axes([0.85, 0.1, 0.075, 0.8]) >> colorbar(cax=cax) >> >> as a template (from >> http://matplotlib.sourceforge.net/examples/pylab_examples/subplots_adjust.html) >> >> However I get an error: >> >> Traceback (most recent call last): >> File "cornwall2.py", line 640, in <module> >> >> draw_parishes(n_parishes,m_parishes,preoccratio_parishes,0,nthroot,scaling) >> File "cornwall2.py", line 112, in draw_parishes >> colorbar(cax=cax) >> File >> "c:\python25\lib\site-packages\matplotlib-0.98.3.0001-py2.5-win32.egg\matplotlib\pyplot.py", >> line 1295, in colorbar >> ret = gcf().colorbar(mappable, cax = cax, ax=ax, **kw) >> File >> "c:\python25\lib\site-packages\matplotlib-0.98.3.0001-py2.5-win32.egg\matplotlib\figure.py", >> line 977, in colorbar >> cb = cbar.Colorbar(cax, mappable, **kw) >> File >> "c:\python25\lib\site-packages\matplotlib-0.98.3.0001-py2.5-win32.egg\matplotlib\colorbar.py", >> line 595, in __init__ >> mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax >> AttributeError: 'NoneType' object has no attribute 'autoscale_None' >> >> >> How am I using colorbar incorrectly? >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by: >> SourcForge Community >> SourceForge wants to tell your story. >> http://p.sf.net/sfu/sf-spreadtheword >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: David T. <dl...@ca...> - 2009-01-17 10:23:27
|
I think I realised what I was doing wrong, I didn't have the imshow()
call beforehand in my program:
But using the code:
cax = fig.add_axes([0.85, 0.1, 0.075, 0.8])
a=outer(arange(0,1,0.01),ones(10))
imshow(a,aspect='auto',cmap=cm.gray,origin='lower')
I get a set of axes from 0 to 10 in the x direction and 0 to 100 in
y.How do I get rid of the x axis and scale the y axis from 0 to 1.
David
David Trethewey wrote:
> I've been trying to add a colorbar to my figure and have used the
> following code;
>
> cax = axes([0.85, 0.1, 0.075, 0.8])
> colorbar(cax=cax)
>
> as a template (from
> http://matplotlib.sourceforge.net/examples/pylab_examples/subplots_adjust.html)
>
> However I get an error:
>
> Traceback (most recent call last):
> File "cornwall2.py", line 640, in <module>
>
> draw_parishes(n_parishes,m_parishes,preoccratio_parishes,0,nthroot,scaling)
> File "cornwall2.py", line 112, in draw_parishes
> colorbar(cax=cax)
> File
> "c:\python25\lib\site-packages\matplotlib-0.98.3.0001-py2.5-win32.egg\matplotlib\pyplot.py",
> line 1295, in colorbar
> ret = gcf().colorbar(mappable, cax = cax, ax=ax, **kw)
> File
> "c:\python25\lib\site-packages\matplotlib-0.98.3.0001-py2.5-win32.egg\matplotlib\figure.py",
> line 977, in colorbar
> cb = cbar.Colorbar(cax, mappable, **kw)
> File
> "c:\python25\lib\site-packages\matplotlib-0.98.3.0001-py2.5-win32.egg\matplotlib\colorbar.py",
> line 595, in __init__
> mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax
> AttributeError: 'NoneType' object has no attribute 'autoscale_None'
>
>
> How am I using colorbar incorrectly?
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
|
|
From: David T. <dl...@ca...> - 2009-01-17 10:05:22
|
I've been trying to add a colorbar to my figure and have used the following code; cax = axes([0.85, 0.1, 0.075, 0.8]) colorbar(cax=cax) as a template (from http://matplotlib.sourceforge.net/examples/pylab_examples/subplots_adjust.html) However I get an error: Traceback (most recent call last): File "cornwall2.py", line 640, in <module> draw_parishes(n_parishes,m_parishes,preoccratio_parishes,0,nthroot,scaling) File "cornwall2.py", line 112, in draw_parishes colorbar(cax=cax) File "c:\python25\lib\site-packages\matplotlib-0.98.3.0001-py2.5-win32.egg\matplotlib\pyplot.py", line 1295, in colorbar ret = gcf().colorbar(mappable, cax = cax, ax=ax, **kw) File "c:\python25\lib\site-packages\matplotlib-0.98.3.0001-py2.5-win32.egg\matplotlib\figure.py", line 977, in colorbar cb = cbar.Colorbar(cax, mappable, **kw) File "c:\python25\lib\site-packages\matplotlib-0.98.3.0001-py2.5-win32.egg\matplotlib\colorbar.py", line 595, in __init__ mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax AttributeError: 'NoneType' object has no attribute 'autoscale_None' How am I using colorbar incorrectly? |
|
From: C L. <ch...@na...> - 2009-01-17 09:24:15
|
Someplace to start:
----
from matplotlib import cm
shade = cm.bone_r
cmstep = shade.N/len(vg_bulk) #TODO: even *more* elegant to space
colors by time elapsed
for ii in range(len(vg_bulk)):
hue = shade(ii*cmstep)
#convert to moles
for iii in (0,1,2):
vg_bulk[ii][1][iii] = vg_bulk[ii][1][iii]*(10**6*22.4)**-1
ba.plot(vg_bulk[ii][1], vg_sites,
color = hue, linestyle=':', marker='o',label='%d
days'%vg_bulk[ii][0])
----
and here's what I do for linestyle themes, when I don't know how many
lines I'm going to plot but want adjacent ones to be different (and a
set of less than seven looks nice):
----
from itertools import cycle
self.linestyleskwargs = cycle(map(lambda tu:
dict(zip(('color','dashes'),tu)), (('0.5',(4,1,1,1)),('0.4',(2,1)),
('0.3',(5,1,2,1)),('0.2',(4,1)),('0.1',(6,1)), ('0.0',(10,1)))))
for g in self.gases.values():
style = self.linestyleskwargs.next()
p.plot(g.conc,n.linspace(0,self.depth,self.depth/
self.delx),label=g.label, **style)
----
I'm sure either of these examples can be made tidier, or they could be
combined, or one could set up something to replot all the lines in an
existing plot, with nicely spaced colors, once you know how many there
are.
&C
On Jan 16, 2009, at 3:37 PM, Yang Zhang wrote:
> I'm no good at choosing colors. Does matplotlib have a way to
> automatically assign colors (based on a theme), or provide a way to
> choose a color from a theme? (Excel 2007 opened my eyes to this.)
> Currently, when I do:
>
> bar(..., color = 'r', ...)
> bar(..., color = 'y', ...)
> bar(..., color = 'b', ...)
>
> I usually just choose one of the primary colors. It would be nice
> if I
> could instead write the following (or better if the colors could be
> assigned automagically), so I needn't worry about choosing colors:
>
> bar(..., color = themecolor(0), ...)
> bar(..., color = themecolor(1), ...)
> bar(..., color = themecolor(2), ...)
>
> I see these things called colormaps on the home page documentation,
> but
> I can't figure out how to use these (calling autumn() before plotting
> made no change to my plot) or whether they're even what I'm looking
> for.
> Or perhaps there's some Python package out there completely unrelated
> to matplotlib that I could use? Thanks in advance for any hints.
> --
> Yang Zhang
> http://www.mit.edu/~y_z/
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Chloe Lewis
Graduate student, Amundson Lab
Division of Ecosystem Sciences, ESPM
University of California, Berkeley
137 Mulford Hall - #3114
Berkeley, CA 94720-3114
ch...@na...
|
|
From: antonv <vas...@ya...> - 2009-01-17 07:16:58
|
Dear all, I know this is not related to matplotlib but this seems to be the only place where I found people that have knowledge of both NOAA data and python so please bear with me. The .bull file that NOAA gives for upload is an ascii file formatted for human readability but it creates a lot of issues when I am trying to parse it. Here is a link to one of these files: ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/wave/prod/wave.20090117/bulls.t00z/akw.46001.bull Do you have any idea on how to extract the data there in columns for plotting with matplotlib? If you look at the file you'll notice that there is both a header and a footer for the file that needs to be eliminated and the main columns have sub columns also. Another issue is that in a column there is missing data that should keep it's relationship with the time column. And the last issue, some of the values there are preceded by a "*" sign that should just be removed too. Any ideas are greatly appreciated! Anton -- View this message in context: http://www.nabble.com/NOAA-.bull-file-parsing-tp21513800p21513800.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Eric F. <ef...@ha...> - 2009-01-17 04:48:38
|
antonv wrote: > Thanks again! That looks cool and seems that it can be used it to a lot of > other projects I have going on! If you are looking for something to use for your own projects, I recommend not svn but one of the more modern distributed vcs systems: mercurial (hg), bzr, or git. I use and like mercurial: http://www.selenic.com/mercurial/wiki/ Eric > > Anton > > > efiring wrote: >> antonv wrote: >>> Thanks for the quick reply John! Now it makes a lot more sense. The next >>> dumb >>> question is what is SVN and where can I find more bout it? >> http://sourceforge.net/svn/?group_id=80706 >> http://subversion.tigris.org/ |
|
From: antonv <vas...@ya...> - 2009-01-17 04:39:54
|
Thanks again! That looks cool and seems that it can be used it to a lot of other projects I have going on! Anton efiring wrote: > > antonv wrote: >> Thanks for the quick reply John! Now it makes a lot more sense. The next >> dumb >> question is what is SVN and where can I find more bout it? > > http://sourceforge.net/svn/?group_id=80706 > http://subversion.tigris.org/ > > Eric > >> >> >> John Hunter-4 wrote: >>> On Fri, Jan 16, 2009 at 10:33 AM, antonv <vas...@ya...> >>> wrote: >>>> I have a series of 18 separate colors to create my cmap but I would >>>> like >>>> to >>>> convert that to a continuous map which interpolates all the other >>>> values >>>> in >>>> between my chosen colors. This should be really easy but I am not sure >>>> how >>>> can it be solved. Any ideas? >>> Although the logic of the LinearSegmentedColormap takes some time to >>> get your head around, it is pretty easy. >>> >>> >>> http://matplotlib.sourceforge.net/api/colors_api.html#matplotlib.colors.LinearSegmentedColormap >>> >>> >>> Here is an example: >>> >>> import numpy as np >>> import matplotlib.pyplot as plt >>> import matplotlib.colors as mcolors >>> import matplotlib.cm as cm >>> colors = 'red', 'green', 'blue', 'yellow', 'orange' >>> >>> ncolors = len(colors) >>> >>> vals = np.linspace(0., 1., ncolors) >>> >>> cdict = dict(red=[], green=[], blue=[]) >>> for val, color in zip(vals, colors): >>> r,g,b = mcolors.colorConverter.to_rgb(color) >>> cdict['red'].append((val, r, r)) >>> cdict['green'].append((val, g, g)) >>> cdict['blue'].append((val, b, b)) >>> >>> cmap = mcolors.LinearSegmentedColormap('mycolors', cdict) >>> >>> >>> x = np.arange(10000.).reshape((100,100)) >>> >>> plt.imshow(x, cmap=cmap) >>> >>> plt.show() >>> >>> See also >>> http://matplotlib.sourceforge.net/examples/pylab_examples/custom_cmap.html. >>> I just added a function to svn to support this, so with svn you can >>> do >>> >>> >>> colors = 'red', 'gray', 'green' >>> cmap = mcolors.LinearSegmentedColormap.from_list('mycolors', colors) >>> X, Y = np.meshgrid(np.arange(10), np.arange(10)) >>> plt.imshow(X+Y, cmap=cmap) >>> >>> JDH >>> >>> ------------------------------------------------------------------------------ >>> This SF.net email is sponsored by: >>> SourcForge Community >>> SourceForge wants to tell your story. >>> http://p.sf.net/sfu/sf-spreadtheword >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >>> >> > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://www.nabble.com/cmap-from-sepparate-color-values-tp21503197p21513073.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Eric F. <ef...@ha...> - 2009-01-17 04:34:55
|
antonv wrote: > Thanks for the quick reply John! Now it makes a lot more sense. The next dumb > question is what is SVN and where can I find more bout it? http://sourceforge.net/svn/?group_id=80706 http://subversion.tigris.org/ Eric > > > John Hunter-4 wrote: >> On Fri, Jan 16, 2009 at 10:33 AM, antonv <vas...@ya...> >> wrote: >>> I have a series of 18 separate colors to create my cmap but I would like >>> to >>> convert that to a continuous map which interpolates all the other values >>> in >>> between my chosen colors. This should be really easy but I am not sure >>> how >>> can it be solved. Any ideas? >> Although the logic of the LinearSegmentedColormap takes some time to >> get your head around, it is pretty easy. >> >> >> http://matplotlib.sourceforge.net/api/colors_api.html#matplotlib.colors.LinearSegmentedColormap >> >> >> Here is an example: >> >> import numpy as np >> import matplotlib.pyplot as plt >> import matplotlib.colors as mcolors >> import matplotlib.cm as cm >> colors = 'red', 'green', 'blue', 'yellow', 'orange' >> >> ncolors = len(colors) >> >> vals = np.linspace(0., 1., ncolors) >> >> cdict = dict(red=[], green=[], blue=[]) >> for val, color in zip(vals, colors): >> r,g,b = mcolors.colorConverter.to_rgb(color) >> cdict['red'].append((val, r, r)) >> cdict['green'].append((val, g, g)) >> cdict['blue'].append((val, b, b)) >> >> cmap = mcolors.LinearSegmentedColormap('mycolors', cdict) >> >> >> x = np.arange(10000.).reshape((100,100)) >> >> plt.imshow(x, cmap=cmap) >> >> plt.show() >> >> See also >> http://matplotlib.sourceforge.net/examples/pylab_examples/custom_cmap.html. >> I just added a function to svn to support this, so with svn you can >> do >> >> >> colors = 'red', 'gray', 'green' >> cmap = mcolors.LinearSegmentedColormap.from_list('mycolors', colors) >> X, Y = np.meshgrid(np.arange(10), np.arange(10)) >> plt.imshow(X+Y, cmap=cmap) >> >> JDH >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by: >> SourcForge Community >> SourceForge wants to tell your story. >> http://p.sf.net/sfu/sf-spreadtheword >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > |
|
From: Eric F. <ef...@ha...> - 2009-01-17 04:32:26
|
Neal Becker wrote: > On Friday 16 January 2009, Eric Firing wrote: >> Neal Becker wrote: >>> pylab.plot (xaxis, log10 (the_sum)*10) >>> where xaxis is numpy array, and log10(the_sum)*10 is my own class that is >>> a valid python sequence (it is a c++ wrapper around boost::ublas), gives: >>> File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- >>> x86_64.egg/matplotlib/pyplot.py", line 2096, in plot >>> ret = gca().plot(*args, **kwargs) >>> File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- >>> x86_64.egg/matplotlib/axes.py", line 3277, in plot >>> for line in self._get_lines(*args, **kwargs): >>> File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- >>> x86_64.egg/matplotlib/axes.py", line 394, in _grab_next_args >>> for seg in self._plot_2_args(remaining, **kwargs): >>> File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- >>> x86_64.egg/matplotlib/axes.py", line 267, in _plot_2_args >>> if is_string_like(tup2[1]): >>> File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- >>> x86_64.egg/matplotlib/cbook.py", line 277, in is_string_like >>> try: obj + '' >>> RuntimeError: check:: failed >>> >>> If I convert the 2nd arg to array, it works: >>> pylab.plot (xaxis, np.array(log10 (the_sum)*10)) >>> >>> Doesn't plot support arbitrary sequences? >> Partial correction to my previous post: >> is_string_like looks for a TypeError or ValueError to be raised. I >> suppose we could look for any exception, since your object raises a >> RuntimeError. >> >> I wonder whether it would be equally effective and more robust if the >> test were >> >> try: '' + obj >> >> instead of the other way around. >> >> Eric > > IIRC, boost::python translates c++ exceptions to RuntimeError. If true, then > it's a lot easier to fix matplotlib than to fix boost::python wrappers. After poking around a little, I conclude that there is nothing gained by having is_string_like look for particular exceptions, so I will relax that, which should solve your problem with no negative consequences for anything else. I've committed the change to the 98.5 maintenance branch, but I'm having trouble with svnmerge, so I don't know how long it will take to get it into the trunk. Eric |
|
From: antonv <vas...@ya...> - 2009-01-17 04:11:51
|
Thanks for the quick reply John! Now it makes a lot more sense. The next dumb question is what is SVN and where can I find more bout it? John Hunter-4 wrote: > > On Fri, Jan 16, 2009 at 10:33 AM, antonv <vas...@ya...> > wrote: >> >> I have a series of 18 separate colors to create my cmap but I would like >> to >> convert that to a continuous map which interpolates all the other values >> in >> between my chosen colors. This should be really easy but I am not sure >> how >> can it be solved. Any ideas? > > Although the logic of the LinearSegmentedColormap takes some time to > get your head around, it is pretty easy. > > > http://matplotlib.sourceforge.net/api/colors_api.html#matplotlib.colors.LinearSegmentedColormap > > > Here is an example: > > import numpy as np > import matplotlib.pyplot as plt > import matplotlib.colors as mcolors > import matplotlib.cm as cm > colors = 'red', 'green', 'blue', 'yellow', 'orange' > > ncolors = len(colors) > > vals = np.linspace(0., 1., ncolors) > > cdict = dict(red=[], green=[], blue=[]) > for val, color in zip(vals, colors): > r,g,b = mcolors.colorConverter.to_rgb(color) > cdict['red'].append((val, r, r)) > cdict['green'].append((val, g, g)) > cdict['blue'].append((val, b, b)) > > cmap = mcolors.LinearSegmentedColormap('mycolors', cdict) > > > x = np.arange(10000.).reshape((100,100)) > > plt.imshow(x, cmap=cmap) > > plt.show() > > See also > http://matplotlib.sourceforge.net/examples/pylab_examples/custom_cmap.html. > I just added a function to svn to support this, so with svn you can > do > > > colors = 'red', 'gray', 'green' > cmap = mcolors.LinearSegmentedColormap.from_list('mycolors', colors) > X, Y = np.meshgrid(np.arange(10), np.arange(10)) > plt.imshow(X+Y, cmap=cmap) > > JDH > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://www.nabble.com/cmap-from-sepparate-color-values-tp21503197p21512920.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Eric F. <ef...@ha...> - 2009-01-17 02:46:59
|
Neal Becker wrote: > On Friday 16 January 2009, Eric Firing wrote: >> Neal Becker wrote: >>> pylab.plot (xaxis, log10 (the_sum)*10) >>> where xaxis is numpy array, and log10(the_sum)*10 is my own class that is >>> a valid python sequence (it is a c++ wrapper around boost::ublas), gives: >>> File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- >>> x86_64.egg/matplotlib/pyplot.py", line 2096, in plot >>> ret = gca().plot(*args, **kwargs) >>> File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- >>> x86_64.egg/matplotlib/axes.py", line 3277, in plot >>> for line in self._get_lines(*args, **kwargs): >>> File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- >>> x86_64.egg/matplotlib/axes.py", line 394, in _grab_next_args >>> for seg in self._plot_2_args(remaining, **kwargs): >>> File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- >>> x86_64.egg/matplotlib/axes.py", line 267, in _plot_2_args >>> if is_string_like(tup2[1]): >>> File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- >>> x86_64.egg/matplotlib/cbook.py", line 277, in is_string_like >>> try: obj + '' >>> RuntimeError: check:: failed >>> >>> If I convert the 2nd arg to array, it works: >>> pylab.plot (xaxis, np.array(log10 (the_sum)*10)) >>> >>> Doesn't plot support arbitrary sequences? >> Not *completely* arbitrary, evidently. It has to raise a Python >> exception when an invalid operation (specifically, adding an empty >> string) is attempted. Apparently your wrapper is not doing this. This >> is the duck-typing check for a string that mpl has used from early times. >> >> Eric > Is it possible that this could be better? I'm not sure what's happening here, > but I think it is trying to see if my type can be a string first. It can, but > that's not a good idea in this case. It should correctly support a sequence > (and iterator) protocol. Shouldn't matplotlib try that first? > No, it really needs to find out if it is a string, and a string is iterable, so a string-specific check is needed. Eric |
|
From: Eric F. <ef...@ha...> - 2009-01-17 02:45:01
|
Neal Becker wrote: > pylab.plot (xaxis, log10 (the_sum)*10) > where xaxis is numpy array, and log10(the_sum)*10 is my own class that is a > valid python sequence (it is a c++ wrapper around boost::ublas), gives: > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > x86_64.egg/matplotlib/pyplot.py", line 2096, in plot > ret = gca().plot(*args, **kwargs) > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > x86_64.egg/matplotlib/axes.py", line 3277, in plot > for line in self._get_lines(*args, **kwargs): > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > x86_64.egg/matplotlib/axes.py", line 394, in _grab_next_args > for seg in self._plot_2_args(remaining, **kwargs): > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > x86_64.egg/matplotlib/axes.py", line 267, in _plot_2_args > if is_string_like(tup2[1]): > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > x86_64.egg/matplotlib/cbook.py", line 277, in is_string_like > try: obj + '' > RuntimeError: check:: failed > > If I convert the 2nd arg to array, it works: > pylab.plot (xaxis, np.array(log10 (the_sum)*10)) > > Doesn't plot support arbitrary sequences? Partial correction to my previous post: is_string_like looks for a TypeError or ValueError to be raised. I suppose we could look for any exception, since your object raises a RuntimeError. I wonder whether it would be equally effective and more robust if the test were try: '' + obj instead of the other way around. Eric |
|
From: Neal B. <ndb...@gm...> - 2009-01-17 02:44:08
|
On Friday 16 January 2009, Eric Firing wrote: > Neal Becker wrote: > > pylab.plot (xaxis, log10 (the_sum)*10) > > where xaxis is numpy array, and log10(the_sum)*10 is my own class that is > > a valid python sequence (it is a c++ wrapper around boost::ublas), gives: > > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > > x86_64.egg/matplotlib/pyplot.py", line 2096, in plot > > ret = gca().plot(*args, **kwargs) > > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > > x86_64.egg/matplotlib/axes.py", line 3277, in plot > > for line in self._get_lines(*args, **kwargs): > > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > > x86_64.egg/matplotlib/axes.py", line 394, in _grab_next_args > > for seg in self._plot_2_args(remaining, **kwargs): > > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > > x86_64.egg/matplotlib/axes.py", line 267, in _plot_2_args > > if is_string_like(tup2[1]): > > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > > x86_64.egg/matplotlib/cbook.py", line 277, in is_string_like > > try: obj + '' > > RuntimeError: check:: failed > > > > If I convert the 2nd arg to array, it works: > > pylab.plot (xaxis, np.array(log10 (the_sum)*10)) > > > > Doesn't plot support arbitrary sequences? > > Partial correction to my previous post: > is_string_like looks for a TypeError or ValueError to be raised. I > suppose we could look for any exception, since your object raises a > RuntimeError. > > I wonder whether it would be equally effective and more robust if the > test were > > try: '' + obj > > instead of the other way around. > > Eric IIRC, boost::python translates c++ exceptions to RuntimeError. If true, then it's a lot easier to fix matplotlib than to fix boost::python wrappers. |
|
From: Neal B. <ndb...@gm...> - 2009-01-17 02:42:16
|
On Friday 16 January 2009, Eric Firing wrote: > Neal Becker wrote: > > pylab.plot (xaxis, log10 (the_sum)*10) > > where xaxis is numpy array, and log10(the_sum)*10 is my own class that is > > a valid python sequence (it is a c++ wrapper around boost::ublas), gives: > > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > > x86_64.egg/matplotlib/pyplot.py", line 2096, in plot > > ret = gca().plot(*args, **kwargs) > > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > > x86_64.egg/matplotlib/axes.py", line 3277, in plot > > for line in self._get_lines(*args, **kwargs): > > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > > x86_64.egg/matplotlib/axes.py", line 394, in _grab_next_args > > for seg in self._plot_2_args(remaining, **kwargs): > > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > > x86_64.egg/matplotlib/axes.py", line 267, in _plot_2_args > > if is_string_like(tup2[1]): > > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > > x86_64.egg/matplotlib/cbook.py", line 277, in is_string_like > > try: obj + '' > > RuntimeError: check:: failed > > > > If I convert the 2nd arg to array, it works: > > pylab.plot (xaxis, np.array(log10 (the_sum)*10)) > > > > Doesn't plot support arbitrary sequences? > > Not *completely* arbitrary, evidently. It has to raise a Python > exception when an invalid operation (specifically, adding an empty > string) is attempted. Apparently your wrapper is not doing this. This > is the duck-typing check for a string that mpl has used from early times. > > Eric Is it possible that this could be better? I'm not sure what's happening here, but I think it is trying to see if my type can be a string first. It can, but that's not a good idea in this case. It should correctly support a sequence (and iterator) protocol. Shouldn't matplotlib try that first? |
|
From: Eric F. <ef...@ha...> - 2009-01-17 02:39:26
|
Neal Becker wrote: > pylab.plot (xaxis, log10 (the_sum)*10) > where xaxis is numpy array, and log10(the_sum)*10 is my own class that is a > valid python sequence (it is a c++ wrapper around boost::ublas), gives: > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > x86_64.egg/matplotlib/pyplot.py", line 2096, in plot > ret = gca().plot(*args, **kwargs) > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > x86_64.egg/matplotlib/axes.py", line 3277, in plot > for line in self._get_lines(*args, **kwargs): > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > x86_64.egg/matplotlib/axes.py", line 394, in _grab_next_args > for seg in self._plot_2_args(remaining, **kwargs): > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > x86_64.egg/matplotlib/axes.py", line 267, in _plot_2_args > if is_string_like(tup2[1]): > File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux- > x86_64.egg/matplotlib/cbook.py", line 277, in is_string_like > try: obj + '' > RuntimeError: check:: failed > > If I convert the 2nd arg to array, it works: > pylab.plot (xaxis, np.array(log10 (the_sum)*10)) > > Doesn't plot support arbitrary sequences? Not *completely* arbitrary, evidently. It has to raise a Python exception when an invalid operation (specifically, adding an empty string) is attempted. Apparently your wrapper is not doing this. This is the duck-typing check for a string that mpl has used from early times. Eric |
|
From: Neal B. <ndb...@gm...> - 2009-01-17 00:17:39
|
pylab.plot (xaxis, log10 (the_sum)*10)
where xaxis is numpy array, and log10(the_sum)*10 is my own class that is a
valid python sequence (it is a c++ wrapper around boost::ublas), gives:
File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-
x86_64.egg/matplotlib/pyplot.py", line 2096, in plot
ret = gca().plot(*args, **kwargs)
File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-
x86_64.egg/matplotlib/axes.py", line 3277, in plot
for line in self._get_lines(*args, **kwargs):
File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-
x86_64.egg/matplotlib/axes.py", line 394, in _grab_next_args
for seg in self._plot_2_args(remaining, **kwargs):
File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-
x86_64.egg/matplotlib/axes.py", line 267, in _plot_2_args
if is_string_like(tup2[1]):
File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-
x86_64.egg/matplotlib/cbook.py", line 277, in is_string_like
try: obj + ''
RuntimeError: check:: failed
If I convert the 2nd arg to array, it works:
pylab.plot (xaxis, np.array(log10 (the_sum)*10))
Doesn't plot support arbitrary sequences?
|