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

Showing 14 results of 14

From: Stephen E. <mat...@re...> - 2010年07月15日 22:45:21
On 14/07/2010 23:32, Eric Firing wrote:
> On 07/14/2010 11:41 AM, Stephen Evans wrote:
> 
>> Hi,
>>
>> While testing Psyco V2 to see if it would offer any speed improvements I
>> tried it with some applications using matplotlib. Exceptions were raised
>> that were easily resolved by replacing calls to min() and max() with
>> their numpy equivalents numpy.amin() and numpy.amax() in the matplotlib
>> code.
>>
>> Simply demonstrated by inserting at the beginning of, say, matplotlib's
>> examples/api/barchart_demo.py :
>>
>> import psyco
>> psyco.full()
>>
>> which caused:
>>
>> Traceback (most recent call last):
>> File "barchart_demo.py", line 29, in<module>
>> ax.set_xticks(ind+width)
>> File "c:\python26\lib\site-packages\matplotlib\axes.py", line 2064,
>> in set_xticks
>> return self.xaxis.set_ticks(ticks, minor=minor)
>> File "c:\python26\lib\site-packages\matplotlib\axis.py", line 1154,
>> in set_ticks
>> self.set_view_interval(min(ticks), max(ticks))
>> File "c:\python26\lib\site-packages\psyco\builtin.py", line 75, in min
>> return _min(*args)
>> File "c:\python26\lib\site-packages\psyco\builtin.py", line 34, in _min
>> if not iterable:
>> ValueError: The truth value of an array with more than one element is
>> ambiguous. Use a.any() or a.all()
>>
>>
>> software used:
>>
>> Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit
>> (Intel)] on win32
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import psyco
>> >>> psyco.version_info
>> (2, 0, 0, 'final', 0)
>> >>> import numpy
>> >>> numpy.version.version
>> '1.4.1'
>> >>> import matplotlib
>> >>> matplotlib.__version__
>> '0.99.3'
>>
>>
>> Psyco V2 is available from: http://codespeak.net/svn/psyco/v2/dist/
>>
>> Should numpy.min()/numpy.amin() be used on array like objects within
>> matplotlib, or is min() adequate ? Ditto max().
>> 
> When short sequences are involved, min() is much faster than amin(). If
> min() is called only a few times per plot in such cases, using the
> slower function would cause a negligible slowdown. I'm reluctant to
> change mpl to work around a bug in psyco, though.
>
> When you did make the substitution and do the test, was there a big speedup?
>
> Eric
> 
For a quick check of any speedup I timed some runs on two plots using 
one of my applications with real world data. 4 runs, average of last 3, 
with some meaningless precision:
a) one subplot of 44000 points
b) two subplots of 1.4M points each
using freshly installed matplotlib 1.0
a) 2.97 seconds
b) 37.85
with psyco and changing min() max() to numpy.amin() numpy.amax() where 
appropriate in matplotlib
a) 3.05
b) 27.48
without psyco, but with the changes above
a) 2.96
b) 37.52
Not a rigorous test, but psyco causes a definite speedup in the larger 
plot. Whether this applies throughout matplotlib on all platforms is 
another matter. Hopefully anyone who is using psyco with 
numpy/matplotlib should be able to patch matplotlib themselves where 
required. If it ain't broke, don't fix it.
Stephen
>> Stephen Evans
>>
>> (Out of interest I came across numpy ticket #1286 while looking for this
>> issue.)
>>
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by Sprint
>> What will you do first with EVO, the first 4G phone?
>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> 
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> 
From: texas_ranger <dw...@gm...> - 2010年07月15日 19:45:05
The source code for radar_chart.py located in the Matplotlib docs at 
http://matplotlib.sourceforge.net/examples/api/radar_chart.html?highlight=radar%20chart
does not work. Seems to be problem with legend.
Can someone tell me what's wrong with the source code so I can correct my
copy?
-- 
View this message in context: http://old.nabble.com/radar_chart-in-matplotlib-doc-does-not-work-tp29177027p29177027.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Benjamin R. <ben...@ou...> - 2010年07月15日 19:38:55
Since no-one has replied to this, let me see if I can come up with an idea.
Assuming you are using Linux or a Mac, I wonder if it is somehow possible to
"save" a .ps file to a postscript device? I have never had to do any Linux
magic with CUPS, so maybe this isn't possible. Anybody else have any
thoughts?
Ben Root
On Tue, Jul 13, 2010 at 6:27 AM, sa6113 <s.p...@gm...> wrote:
>
> Dear all,
>
> I want to print the plotted curves to a printer NOT to a file.
> if you know somthing such as "QwtPlotPrintFilter " class in Qwt.
>
> Which module help me?
>
> --
> View this message in context:
> http://old.nabble.com/print-to-aprint-device%21-tp29149286p29149286.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Ryan M. <rm...@gm...> - 2010年07月15日 18:22:32
On Thu, Jul 15, 2010 at 8:41 AM, Waléria Antunes David
<wal...@gm...> wrote:
> Hi all,
>
> I have a code base so that:
>
>
> from pylab import *
> x = arange (3000,3400)
> y = -108 * (3.0e14 ** 2)/x**2
>
> pylab..title("Teste")
> pylab.savefig("imagem.png")
> plot(x, y)
>
>
> Well.... the values of the function range(3000,3400) are in Hz......i need
> to pass GHz which would be in scientific notation as follows bellow:
>
> 3000 Hz = 3,0 ×ばつ 10-6 GHz
> 3400 Hz = 3,4 x 10-6 Ghz
>
> How do I make the graph x-axis is shown in figures
> scientific notation, for this currently so
>
> 3000,3050,3100,....,3400
>
> in scientific notation is: (3.0e-6, 3.4e-6)
One way is to just change the values in the GHz and plot them:
plot(x/1e9, y)
# Need to change some limits so that they show up in scientific notation:
gca().xaxis.get_major_formatter().set_powerlimits((-5,5))
The other way is make a custom formatter that changes the values of the ticks:
def fmt_ghz(val, pos=None):
 return '%g' % (val / 1e9)
plot(x, y)
gca().xaxis.set_major_formatter(FuncFormatter(fmt_ghz))
You can get more information here:
http://matplotlib.sourceforge.net/api/ticker_api.html
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Waléria A. D. <wal...@gm...> - 2010年07月15日 14:32:36
But, i don't know how do...
I tried, but don't, most failed....
On Thu, Jul 15, 2010 at 11:25 AM, Benjamin Root <ben...@ou...> wrote:
>
> On Thu, Jul 15, 2010 at 8:41 AM, Waléria Antunes David <
> wal...@gm...> wrote:
>
>> Hi all,
>>
>> I have a code base so that:
>>
>>
>> from pylab import *
>> x = arange (3000,3400)
>> y = -108 * (3.0e14 ** 2)/x**2
>>
>> pylab..title("Teste")
>> pylab.savefig("imagem.png")
>> plot(x, y)
>>
>>
>> Well.... the values of the function range(3000,3400) are in Hz......i need
>> to pass GHz which would be in scientific notation as follows bellow:
>>
>> 3000 Hz = 3,0 ×ばつ 10-6 GHz
>> 3400 Hz = 3,4 x 10-6 Ghz
>>
>> How do I make the graph x-axis is shown in figures
>> scientific notation, for this currently so
>>
>> 3000,3050,3100,....,3400
>>
>> in scientific notation is: (3.0e-6, 3.4e-6)
>>
>> Can someone help me?
>>
>> See my attachment....
>>
>> I need to show this values in scientific notation......
>>
>> Waléria
>>
>>
>>
> Waleria,
>
> I believe you are looking to use the ticker API. Particularly the
> FormatStrFormatter that accepts a sprintf()-like format string to express
> your tick values. For your particular example, --off the top of my head--
> the string format would be "%.1e".
>
> http://matplotlib.sourceforge.net/api/ticker_api.html
>
> I hope this helps.
>
> Ben Root
>
From: Benjamin R. <ben...@ou...> - 2010年07月15日 14:25:53
On Thu, Jul 15, 2010 at 8:41 AM, Waléria Antunes David <
wal...@gm...> wrote:
> Hi all,
>
> I have a code base so that:
>
>
> from pylab import *
> x = arange (3000,3400)
> y = -108 * (3.0e14 ** 2)/x**2
>
> pylab..title("Teste")
> pylab.savefig("imagem.png")
> plot(x, y)
>
>
> Well.... the values of the function range(3000,3400) are in Hz......i need
> to pass GHz which would be in scientific notation as follows bellow:
>
> 3000 Hz = 3,0 ×ばつ 10-6 GHz
> 3400 Hz = 3,4 x 10-6 Ghz
>
> How do I make the graph x-axis is shown in figures
> scientific notation, for this currently so
>
> 3000,3050,3100,....,3400
>
> in scientific notation is: (3.0e-6, 3.4e-6)
>
> Can someone help me?
>
> See my attachment....
>
> I need to show this values in scientific notation......
>
> Waléria
>
>
>
Waleria,
I believe you are looking to use the ticker API. Particularly the
FormatStrFormatter that accepts a sprintf()-like format string to express
your tick values. For your particular example, --off the top of my head--
the string format would be "%.1e".
http://matplotlib.sourceforge.net/api/ticker_api.html
I hope this helps.
Ben Root
From: Clear <c.m...@gm...> - 2010年07月15日 13:47:15
Hello,
I would like to know if it is possible to display the following feature
using matplotlib. Say that you have a 2D plot(x,y) with a lot of data. You
plot the data using a 2D solid line. Would be possible to add "some"
circles/squared or whatever to the solid line? When I say "some" I mean only
scattered values, otherwise given the quantity of data you would appreciate
the symbols.
Thanks,
Clear
-- 
View this message in context: http://old.nabble.com/Scattered-symbols-data-tp29173029p29173029.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Stephen T. <obs...@ho...> - 2010年07月15日 05:47:52
Hi Friedrich,
Thanks so much for your response! 
> Date: Wed, 7 Jul 2010 20:16:24 +0200
> 
> Since you are 10.5, I think your default compiler is gcc-4.0 if I'm
> not very much mistaken. Can you please verify that by issuing gcc
> --version?
> 
> I had a private conversation with the "owner" of the previous thread
> about OS X, and it seems that there are two ways to build matplotlib.
> I personally had no luck with the prebuilt version either, but I don't
> remember the issue, I think it wasn't compatible with my gcc-4.2
> compiled freetype2 (I'm on 10.6).
> 
> a) Use make.osx. This is quite easy, but you have no control over
> where the libraries are installed, and if you do not log it via 2>&1 |
> tee log.txt we will be unable to diagnose. make.osx installs
> libraries in your system, so be aware of this.
> 
> b) Install the libraries on your own. This seems to be a little more
> complicated, but it isn't really. I used libpng 1.4 with a few
> modifications, just a few lines in src/_png.cpp. (You also may
> already have recent enough versions through your /opt/ path.)
> 
> Sorry, I'm writing this again and again to all the users I tried to
> convice of this way, but I didn't find inclination to do it properly
> together with the developers on the website.
It is indeed true that I have gcc 4.0i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)
> Did you compile Python 2.6 yourself? If yes, have you made sure to
> use the --enable-framework switch for configure?
I installed it using a pre-compiled binary for OS X Leopard, so I did not set any options. Perhaps I should build from source and add this option?
> 
> > I've tried EasyInstall, svn, and dmg. The dmg expects Apple Python 2.6 so
> > that's out. For the EasyInstall and svn routes I think I must be missing
> > some external libraries? Below are some snippets of warnings/error messages:
> 
> It would be helpful to have information about the initial diagnostic
> output of the setup.py call, but I don't know if easy_install works
> that way. The installation routine tells there what libraries are
> found and if you have pkg-config it tells also the version found.
> 
> > from EasyInstall:
> > $ easy_install matplotlib
> >
> > matplotlib: 0.99.3
> > warning: no files found matching 'MANIFEST'
> > warning: no files found matching 'lib/mpl_toolkits'
> > ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required
> > architecture
> > ld warning: in /opt/local/lib/libz.dylib, file is not of required
> > architecture
> > ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required
> > architecture
> > ld warning: in /opt/local/lib/libz.dylib, file is not of required
> > architecture
> > ld warning: in /opt/local/lib/libpng12.dylib, file is not of required
> > architecture
> > ld warning: in /opt/local/lib/libz.dylib, file is not of required
> > architecture
> > ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required
> > architecture
> > ld warning: in /opt/local/lib/libz.dylib, file is not of required
> > architecture
> > ld: in /opt/local/lib/libxml2.2.dylib, file is not of required architecture
> > for architecture ppc
> 
> I think /opt/ installs are macports or similar? What kind of "package
> system" for Mac do you have installed?
That is true... I do have Macports installed and /opt/ is for Macports. But for Python, Numpy, and Scipy, I used the pre-compiled binaries for OS X; the matplotlib I am trying to install now is from the subversion repository. I am not sure what you mean by the initial diagnostic output (perhaps output below?), but I used make.osx and specified that zlib, png and freetype be installed in my ~/dev directory as shown in README.osx and make.osx. I also added all the paths recursively to my PATH in case it was using this variable to look for these programs, but my output error still looks like
basedirlist is: []============================================================================BUILDING MATPLOTLIB matplotlib: 1.0.svn python: 2.6.5 (r265:79359, Mar 24 2010, 01:32:55) [GCC 4.0.1 (Apple Inc. build 5493)] platform: darwin
REQUIRED DEPENDENCIES numpy: 1.4.1 freetype2: 9.20.3
OPTIONAL BACKEND DEPENDENCIES libpng: 1.2.35 Tkinter: Tkinter: 73770, Tk: 8.4, Tcl: 8.4 wxPython: no * wxPython not found Gtk+: no * Building for Gtk+ requires pygtk; you must be able * to "import gtk" in your build/install environment Mac OS X native: yes Qt: no Qt4: no Cairo: no
OPTIONAL DATE/TIMEZONE DEPENDENCIES datetime: present, version unknown dateutil: matplotlib will provide pytz: matplotlib will provideadding pytz
OPTIONAL USETEX DEPENDENCIES dvipng: 1.9 ghostscript: 8.64 latex: 3.141592 pdftops: 3.02
[...] and then:ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required architectureld warning: in /opt/local/lib/libz.dylib, file is not of required architectureld: in /opt/local/lib/libxml2.2.dylib, file is not of required architecture for architecture ppccollect2: ld returned 1 exit statusld warning: duplicate dylib /opt/local/lib/libz.1.dyliblipo: can't open input file: /var/folders/Yh/Yh3On1j+FXW+r-334Wk-vk+++TI/-Tmp-//ccUX0Ard.out (No such file or directory)error: command 'c++' failed with exit status 1
> > collect2: ld returned 1 exit status
> 
> It doesn't tell which arch it's missing. I'm a bit confused about
> this "missing architecture". What arch does your system have?
> 
My architecture is an Intel Core 2 Duo 2 GHz (64-bit). 
> Please be prepared that it may take a while to sort out all the issues
> on our way. But I'm sure it's worth!
Sorry for my delayed response - I am currently on travel... but I hope this is fixable. If nothing else comes to mind, I will try installing Python 2.6 from source with the option you mentioned?
Thanks so much!Stephen
 		 	 		 
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4 
From: Steve M. <st...@st...> - 2010年07月15日 02:37:21
Eric - 
Thank you very much. This is exactly what I was looking to do. I should have realized the levels are boundaries, and my color array was not matched to the number of regions. The need for BoundaryNorm makes total sense. Time to stop blindly hacking. Thanks for your example script.
- steve
On Jul 14, 2010, at 6:18 PM, Eric Firing wrote:
> On 07/14/2010 12:52 PM, Steve McFarlin wrote:
>> Hello,
>> 
>> I am trying to create a color map that maps 18 colors across 50 levels. As an example let say I have three colors [r,g,b] and want everything between 1 an 2 to be r, 3 through 10 to be g, and 11 through 50 to be b. From what I can tell it does not seem to be possible. Currently this is what I have, but it does not seem to work as I assumed.
>> 
>> colorList = [[0.,0.,102./255.],[0,42./255.,217./255.],[0,110./255.,217./255.],[0,178./255.,217./255.],
>> [0,212./255.,212./255.],[0,217./255.,166./255.],[0,217./255.,0],[149./255.,217./255.,0],
>> [217./255.,217./255.,0],[217./255.,174./255.,0],[217./255.,131./255.,0],[217./255.,87./255.,0],
>> [217./255.,0,0],[174./255.,0,0],[140./255.,0,0],[135./255.,0,0],
>> [105./255.,0,0],[65./255.,0,0]]
>> 
>> levels = [1,2,3,4,5,6,7,8,9,10,12,15,20,25,30,35,40,50]
>> cmap = matplotlib.colors.ListedColormap(colorList, name = 'theColorMap', N = len(colorList))
>> ...
>> m.contourf(x,y,z,cmap=cmap, levels=levels, extend='both')
>> 
>> If the levels array is continuous then it works as expected. With the above settings I get unexpected results, which includes 'ghost contour lines'. The data I am rendering is from a GRIB file from NOAA.
> 
> I think there is some confusion of terminology here, and the "ghost contour lines" are the least of your problems.
> 
> The contourf "levels" are giving boundaries of regions, so with 18 levels, you have 17 regions.
> 
> I suspect that what you want is illustrated by the attached extremely simple example. (You may or may not want to use the spacing kwarg to colorbar.)
> 
> Eric
> 
>> 
>> Is this possible?
>> 
>> 
>> Thanks,
>> Steve
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by Sprint
>> What will you do first with EVO, the first 4G phone?
>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> <contourf_boundary_norm.py>------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Steve M. <st...@st...> - 2010年07月15日 01:51:46
Ben - 
The problem is occurring on os-x. I am a version behind on the libraries on this machine. With the latest libraries (installed a few days ago on debian) this problem does not occur with the agg backend. I think it is time to sit down and learn the library rather then hack at it. Thanks for your help. 
Steve
On Jul 14, 2010, at 6:17 PM, Benjamin Root wrote:
> Steve,
> 
> Which backend are you using? For TkAgg, this works:
> 
> m.contourf(x, y, z, levels=levels, cmap=cmap, antialiased=False)
> 
> Ben Root
> 
> 
> 
> On Wed, Jul 14, 2010 at 8:00 PM, Steve McFarlin <st...@st...> wrote:
> Ben - 
> 
> I got ahead of myself my cropping the image. The color mapping is correct. It is just different then what I expected. I thought it would partition the height field data based on the levels array and index into the color array. Turning off antialiasing did not solve the 'ghost lines'. I will play around with some of the arguments. It looks to me as if contour is being called with a line width of 1 and a color of white. Setting these line width to 0 did not make a difference.
> 
> 
> Thanks,
> Steve 
> 
> On Jul 14, 2010, at 5:24 PM, Benjamin Root wrote:
> 
>> Steve,
>> 
>> The ghost lines appear to be an artifact of the anti-aliasing. In my tests, setting antialiased=False eliminates those lines.
>> 
>> The colormap looks fine to me. If you doubt it, try turning on the colorbar to see if the values are correctly associated with the proper colors.
>> 
>> Ben Root
>> 
>> 
>> On Wed, Jul 14, 2010 at 6:24 PM, Steve McFarlin <st...@st...> wrote:
>> Ben - 
>> 
>> You can see the image at http://www.surfguru.com/smc/TestRender.png . With a continuous level array [1 .. 18] the image looks like http://www.surfguru.com/smc/TestRender2.png
>> 
>> 
>> Thanks,
>> Steve
>> 
>> On Jul 14, 2010, at 4:12 PM, Benjamin Root wrote:
>> 
>>> Steve,
>>> 
>>> Could you please attach an example image of what you are seeing?
>>> 
>>> Ben Root
>>> 
>>> On Wed, Jul 14, 2010 at 5:52 PM, Steve McFarlin <st...@st...> wrote:
>>> Hello,
>>> 
>>> I am trying to create a color map that maps 18 colors across 50 levels. As an example let say I have three colors [r,g,b] and want everything between 1 an 2 to be r, 3 through 10 to be g, and 11 through 50 to be b. From what I can tell it does not seem to be possible. Currently this is what I have, but it does not seem to work as I assumed.
>>> 
>>> colorList = [[0.,0.,102./255.],[0,42./255.,217./255.],[0,110./255.,217./255.],[0,178./255.,217./255.],
>>> [0,212./255.,212./255.],[0,217./255.,166./255.],[0,217./255.,0],[149./255.,217./255.,0],
>>> [217./255.,217./255.,0],[217./255.,174./255.,0],[217./255.,131./255.,0],[217./255.,87./255.,0],
>>> [217./255.,0,0],[174./255.,0,0],[140./255.,0,0],[135./255.,0,0],
>>> [105./255.,0,0],[65./255.,0,0]]
>>> 
>>> levels = [1,2,3,4,5,6,7,8,9,10,12,15,20,25,30,35,40,50]
>>> cmap = matplotlib.colors.ListedColormap(colorList, name = 'theColorMap', N = len(colorList))
>>> ...
>>> m.contourf(x,y,z,cmap=cmap, levels=levels, extend='both')
>>> 
>>> If the levels array is continuous then it works as expected. With the above settings I get unexpected results, which includes 'ghost contour lines'. The data I am rendering is from a GRIB file from NOAA.
>>> 
>>> Is this possible?
>>> 
>>> 
>>> Thanks,
>>> Steve
>>> ------------------------------------------------------------------------------
>>> This SF.net email is sponsored by Sprint
>>> What will you do first with EVO, the first 4G phone?
>>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>> 
>> 
>> 
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by Sprint
>> What will you do first with EVO, the first 4G phone?
>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> 
>> 
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by Sprint
>> What will you do first with EVO, the first 4G phone?
>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first_______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
From: Eric F. <ef...@ha...> - 2010年07月15日 01:18:51
On 07/14/2010 12:52 PM, Steve McFarlin wrote:
> Hello,
>
> I am trying to create a color map that maps 18 colors across 50 levels. As an example let say I have three colors [r,g,b] and want everything between 1 an 2 to be r, 3 through 10 to be g, and 11 through 50 to be b. From what I can tell it does not seem to be possible. Currently this is what I have, but it does not seem to work as I assumed.
>
> colorList = [[0.,0.,102./255.],[0,42./255.,217./255.],[0,110./255.,217./255.],[0,178./255.,217./255.],
> [0,212./255.,212./255.],[0,217./255.,166./255.],[0,217./255.,0],[149./255.,217./255.,0],
> [217./255.,217./255.,0],[217./255.,174./255.,0],[217./255.,131./255.,0],[217./255.,87./255.,0],
> [217./255.,0,0],[174./255.,0,0],[140./255.,0,0],[135./255.,0,0],
> [105./255.,0,0],[65./255.,0,0]]
>
> levels = [1,2,3,4,5,6,7,8,9,10,12,15,20,25,30,35,40,50]
> cmap = matplotlib.colors.ListedColormap(colorList, name = 'theColorMap', N = len(colorList))
> ...
> m.contourf(x,y,z,cmap=cmap, levels=levels, extend='both')
>
> If the levels array is continuous then it works as expected. With the above settings I get unexpected results, which includes 'ghost contour lines'. The data I am rendering is from a GRIB file from NOAA.
I think there is some confusion of terminology here, and the "ghost 
contour lines" are the least of your problems.
The contourf "levels" are giving boundaries of regions, so with 18 
levels, you have 17 regions.
I suspect that what you want is illustrated by the attached extremely 
simple example. (You may or may not want to use the spacing kwarg to 
colorbar.)
Eric
>
> Is this possible?
>
>
> Thanks,
> Steve
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Benjamin R. <ben...@ou...> - 2010年07月15日 01:17:48
Steve,
Which backend are you using? For TkAgg, this works:
m.contourf(x, y, z, levels=levels, cmap=cmap, antialiased=False)
Ben Root
On Wed, Jul 14, 2010 at 8:00 PM, Steve McFarlin <st...@st...>wrote:
> Ben -
>
> I got ahead of myself my cropping the image. The color mapping is correct.
> It is just different then what I expected. I thought it would partition the
> height field data based on the levels array and index into the color array.
> Turning off antialiasing did not solve the 'ghost lines'. I will play around
> with some of the arguments. It looks to me as if contour is being called
> with a line width of 1 and a color of white. Setting these line width to 0
> did not make a difference.
>
>
> Thanks,
> Steve
>
> On Jul 14, 2010, at 5:24 PM, Benjamin Root wrote:
>
> Steve,
>
> The ghost lines appear to be an artifact of the anti-aliasing. In my
> tests, setting antialiased=False eliminates those lines.
>
> The colormap looks fine to me. If you doubt it, try turning on the
> colorbar to see if the values are correctly associated with the proper
> colors.
>
> Ben Root
>
>
> On Wed, Jul 14, 2010 at 6:24 PM, Steve McFarlin <st...@st...>wrote:
>
>> Ben -
>>
>> You can see the image at http://www.surfguru.com/smc/TestRender.png .
>> With a continuous level array [1 .. 18] the image looks like
>> http://www.surfguru.com/smc/TestRender2.png
>>
>>
>> Thanks,
>> Steve
>>
>> On Jul 14, 2010, at 4:12 PM, Benjamin Root wrote:
>>
>> Steve,
>>
>> Could you please attach an example image of what you are seeing?
>>
>> Ben Root
>>
>> On Wed, Jul 14, 2010 at 5:52 PM, Steve McFarlin <st...@st...>wrote:
>>
>>> Hello,
>>>
>>> I am trying to create a color map that maps 18 colors across 50 levels.
>>> As an example let say I have three colors [r,g,b] and want everything
>>> between 1 an 2 to be r, 3 through 10 to be g, and 11 through 50 to be b.
>>> From what I can tell it does not seem to be possible. Currently this is what
>>> I have, but it does not seem to work as I assumed.
>>>
>>> colorList =
>>> [[0.,0.,102./255.],[0,42./255.,217./255.],[0,110./255.,217./255.],[0,178./255.,217./255.],
>>>
>>> [0,212./255.,212./255.],[0,217./255.,166./255.],[0,217./255.,0],[149./255.,217./255.,0],
>>>
>>> [217./255.,217./255.,0],[217./255.,174./255.,0],[217./255.,131./255.,0],[217./255.,87./255.,0],
>>>
>>> [217./255.,0,0],[174./255.,0,0],[140./255.,0,0],[135./255.,0,0],
>>> [105./255.,0,0],[65./255.,0,0]]
>>>
>>> levels = [1,2,3,4,5,6,7,8,9,10,12,15,20,25,30,35,40,50]
>>> cmap = matplotlib.colors.ListedColormap(colorList, name = 'theColorMap',
>>> N = len(colorList))
>>> ...
>>> m.contourf(x,y,z,cmap=cmap, levels=levels, extend='both')
>>>
>>> If the levels array is continuous then it works as expected. With the
>>> above settings I get unexpected results, which includes 'ghost contour
>>> lines'. The data I am rendering is from a GRIB file from NOAA.
>>>
>>> Is this possible?
>>>
>>>
>>> Thanks,
>>> Steve
>>>
>>> ------------------------------------------------------------------------------
>>> This SF.net email is sponsored by Sprint
>>> What will you do first with EVO, the first 4G phone?
>>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by Sprint
>> What will you do first with EVO, the first 4G phone?
>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first --
> http://p.sf.net/sfu/sprint-com-first_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
From: Steve M. <st...@st...> - 2010年07月15日 01:01:03
Ben - 
I got ahead of myself my cropping the image. The color mapping is correct. It is just different then what I expected. I thought it would partition the height field data based on the levels array and index into the color array. Turning off antialiasing did not solve the 'ghost lines'. I will play around with some of the arguments. It looks to me as if contour is being called with a line width of 1 and a color of white. Setting these line width to 0 did not make a difference.
Thanks,
Steve 
On Jul 14, 2010, at 5:24 PM, Benjamin Root wrote:
> Steve,
> 
> The ghost lines appear to be an artifact of the anti-aliasing. In my tests, setting antialiased=False eliminates those lines.
> 
> The colormap looks fine to me. If you doubt it, try turning on the colorbar to see if the values are correctly associated with the proper colors.
> 
> Ben Root
> 
> 
> On Wed, Jul 14, 2010 at 6:24 PM, Steve McFarlin <st...@st...> wrote:
> Ben - 
> 
> You can see the image at http://www.surfguru.com/smc/TestRender.png . With a continuous level array [1 .. 18] the image looks like http://www.surfguru.com/smc/TestRender2.png
> 
> 
> Thanks,
> Steve
> 
> On Jul 14, 2010, at 4:12 PM, Benjamin Root wrote:
> 
>> Steve,
>> 
>> Could you please attach an example image of what you are seeing?
>> 
>> Ben Root
>> 
>> On Wed, Jul 14, 2010 at 5:52 PM, Steve McFarlin <st...@st...> wrote:
>> Hello,
>> 
>> I am trying to create a color map that maps 18 colors across 50 levels. As an example let say I have three colors [r,g,b] and want everything between 1 an 2 to be r, 3 through 10 to be g, and 11 through 50 to be b. From what I can tell it does not seem to be possible. Currently this is what I have, but it does not seem to work as I assumed.
>> 
>> colorList = [[0.,0.,102./255.],[0,42./255.,217./255.],[0,110./255.,217./255.],[0,178./255.,217./255.],
>> [0,212./255.,212./255.],[0,217./255.,166./255.],[0,217./255.,0],[149./255.,217./255.,0],
>> [217./255.,217./255.,0],[217./255.,174./255.,0],[217./255.,131./255.,0],[217./255.,87./255.,0],
>> [217./255.,0,0],[174./255.,0,0],[140./255.,0,0],[135./255.,0,0],
>> [105./255.,0,0],[65./255.,0,0]]
>> 
>> levels = [1,2,3,4,5,6,7,8,9,10,12,15,20,25,30,35,40,50]
>> cmap = matplotlib.colors.ListedColormap(colorList, name = 'theColorMap', N = len(colorList))
>> ...
>> m.contourf(x,y,z,cmap=cmap, levels=levels, extend='both')
>> 
>> If the levels array is continuous then it works as expected. With the above settings I get unexpected results, which includes 'ghost contour lines'. The data I am rendering is from a GRIB file from NOAA.
>> 
>> Is this possible?
>> 
>> 
>> Thanks,
>> Steve
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by Sprint
>> What will you do first with EVO, the first 4G phone?
>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> 
> 
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Benjamin R. <ben...@ou...> - 2010年07月15日 00:26:10
Steve,
The ghost lines appear to be an artifact of the anti-aliasing. In my tests,
setting antialiased=False eliminates those lines.
The colormap looks fine to me. If you doubt it, try turning on the colorbar
to see if the values are correctly associated with the proper colors.
Ben Root
On Wed, Jul 14, 2010 at 6:24 PM, Steve McFarlin <st...@st...>wrote:
> Ben -
>
> You can see the image at http://www.surfguru.com/smc/TestRender.png . With
> a continuous level array [1 .. 18] the image looks like
> http://www.surfguru.com/smc/TestRender2.png
>
>
> Thanks,
> Steve
>
> On Jul 14, 2010, at 4:12 PM, Benjamin Root wrote:
>
> Steve,
>
> Could you please attach an example image of what you are seeing?
>
> Ben Root
>
> On Wed, Jul 14, 2010 at 5:52 PM, Steve McFarlin <st...@st...>wrote:
>
>> Hello,
>>
>> I am trying to create a color map that maps 18 colors across 50 levels. As
>> an example let say I have three colors [r,g,b] and want everything between 1
>> an 2 to be r, 3 through 10 to be g, and 11 through 50 to be b. From what I
>> can tell it does not seem to be possible. Currently this is what I have, but
>> it does not seem to work as I assumed.
>>
>> colorList =
>> [[0.,0.,102./255.],[0,42./255.,217./255.],[0,110./255.,217./255.],[0,178./255.,217./255.],
>>
>> [0,212./255.,212./255.],[0,217./255.,166./255.],[0,217./255.,0],[149./255.,217./255.,0],
>>
>> [217./255.,217./255.,0],[217./255.,174./255.,0],[217./255.,131./255.,0],[217./255.,87./255.,0],
>>
>> [217./255.,0,0],[174./255.,0,0],[140./255.,0,0],[135./255.,0,0],
>> [105./255.,0,0],[65./255.,0,0]]
>>
>> levels = [1,2,3,4,5,6,7,8,9,10,12,15,20,25,30,35,40,50]
>> cmap = matplotlib.colors.ListedColormap(colorList, name = 'theColorMap', N
>> = len(colorList))
>> ...
>> m.contourf(x,y,z,cmap=cmap, levels=levels, extend='both')
>>
>> If the levels array is continuous then it works as expected. With the
>> above settings I get unexpected results, which includes 'ghost contour
>> lines'. The data I am rendering is from a GRIB file from NOAA.
>>
>> Is this possible?
>>
>>
>> Thanks,
>> Steve
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by Sprint
>> What will you do first with EVO, the first 4G phone?
>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
1 message has been excluded from this view by a project administrator.

Showing 14 results of 14

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