Hi, I have a problem. The following script crashes:
from pylab import *
a=arange(1500).reshape(50,30)
figure()
figimage(a)
show()
Python says:
Traceback (most recent call last):
File "crash.py", line 5, in ?
figimage(a)
File "c:\Python24\lib\site-packages\matplotlib\pylab.py", line 810, in figimage
draw_if_interactive()
File "c:\Python24\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 59, in draw_if_interactive
figManager.show()
File "c:\Python24\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 301, in show
self.canvas.draw()
File "c:\Python24\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 151, in draw
FigureCanvasAgg.draw(self)
File "c:\Python24\lib\site-packages\matplotlib\backends\backend_agg.py", line 398, in draw
self.figure.draw(renderer)
File "c:\Python24\lib\site-packages\matplotlib\figure.py", line 515, in draw
im.draw(renderer)
File "c:\Python24\lib\site-packages\matplotlib\image.py", line 473, in draw
renderer.draw_image(self.ox, self.oy, im, self.origin, self.figure.bbox)
IndexError: Unexpected SeqBase<T> length.
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
As you can see, I'm using Python 2.4. Matplotlib is from the Enthought Python Edition,
version number is 0.87.2. I tried Google, but looking for "Unexpected SeqBase matplotlib" did not help me.
Any hints ?
Greetings, Uwe
Hi,
I would like to plot contours with a nonlinear mapping from values to color as follows:
-1 -> red
0 -> white or green or black
+1 -> red
How can I achieve this ?
Greetings, Uwe
Uwe,
I don't know the answer to your question, but yesterday Rob Hetland sent out and email entitled "Creating a non-linear colormap." that includes example code. That might help you get started.
Ken
Uwe Schmitt wrote:
Hi,
I would like to plot contours with a nonlinear mapping from values to color as follows:
-1 -> red
0 -> white or green or black
+1 -> red
How can I achieve this ?
See examples/contourf_demo.py. The relevant part is this:
# Now make a contour plot with the levels specified,
# and with the colormap generated automatically from a list
# of colors.
levels = [-2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5]
CS3 = contourf(X, Y, Z, levels,
colors = ('r', 'g', 'b'),
origin=origin)
Try specifying 4 levels; I think this would do what you want (with black for the middle range, for example):
levels = [-1.5, -0.5, 0.5, 1.5]
CS = contourf(X, Y, Z, levels, colors=('r', 'k', 'r'))
Eric
···
Greetings, Uwe
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options
Ken McIvor wrote:
Uwe,
I don't know the answer to your question, but yesterday Rob Hetland sent out and email entitled "Creating a non-linear colormap." that includes example code. That might help you get started.
Ken
Thanks, but I can not access this article from the mailing lists archive.
On sourceforge the newest posting is from 23th feb.
Greetings, Uwe
I'm not sure what the problem with SourceForge is. I'll forward you that email off-list.
Ken
···
On Mar 9, 2007, at 5:11 AM, Uwe Schmitt wrote:
Thanks, but I can not access this article from the mailing lists archive.
On sourceforge the newest posting is from 23th feb.
I discovered the same problem, so I went looking and found the mailing list properly archived at nabble.com:
http://www.nabble.com/Creating-a-non-linear-colormap.-t3362841.html
Cheers,
Suresh
···
On Fri, 9 Mar 2007, Ken McIvor wrote:
On Mar 9, 2007, at 5:11 AM, Uwe Schmitt wrote:
Thanks, but I can not access this article from the mailing lists
archive.
On sourceforge the newest posting is from 23th feb.
I'm not sure what the problem with SourceForge is. I'll forward you
that email off-list.
Ken
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options