[Matplotlib-users] Tick label on left and right for yaxis?

2010-03-18 Thread Werner F. Bruhin
Looking at set_ticks_position doc it says that default will reset 
ticks to be on both sides and labels on left, and set_label_position 
only allows for left or right.

Is there any way to have ticks and ticks labels on both left and right?

Werner


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] toolbar

2010-03-18 Thread Philippe Crave
Hello,

the following will display a figure with a plot. the figure will embed
the classic toolbar.

import matplotlib.pyplot as plt
import numpy as np
x=np.arange(0, 1, 0.1)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x)
plt.show()

from there, is it possible to add new buttons to the toolbar ? with
new fonction ?
or do I have to embed everythong in wxPython, GTK or others ?

thank you,
Philippe

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Polar 3D plot?

2010-03-18 Thread Ben Axelrod
I don't see a reason why this can't be implemented.  It is probably pretty 
simple to change the surface plot code to use a polar grid instead of a 
rectangular grid.  Of course this won't change the look of the rectangular 
axes, but maybe that is not a problem.

I invite you to take a shot at implementing this.  You will find the mplot3d 
code pretty straightforward.  (And a lot smaller than you might expect).

-Ben

-Original Message-
From: klukas [mailto:klu...@wisc.edu] 
Sent: Wednesday, March 17, 2010 4:34 PM
To: matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] Polar 3D plot?


I'm guessing this is currently impossible with the current mplot3d 
functionality, but I was wondering if there was any way I could generate a 3d 
graph with r, phi, z coordinates rather than x, y, z?  

The point is that I want to make a figure that looks like the following:
http://upload.wikimedia.org/wikipedia/commons/7/7b/Mexican_hat_potential_polar.svg

Using the x, y, z system, I end up with something that has long tails like
this:
http://upload.wikimedia.org/wikipedia/commons/4/44/Mecanismo_de_Higgs_PH.png

If I try to artificially cut off the data beyond some radius, I end up with 
jagged edges that are not at all visually appealing.

I would appreciate any crazy ideas you can come up with.

Thanks,
Jeff

P.S. Code to produce the ugly jaggedness is included below:

---
from mpl_toolkits.mplot3d import Axes3D
import matplotlib
import numpy as np
from matplotlib import cm
from matplotlib import pyplot as plt

step = 0.04
maxval = 1.0
fig = plt.figure()
ax = Axes3D(fig)
X = np.arange(-maxval, maxval, step)
Y = np.arange(-maxval, maxval, step)
X, Y = np.meshgrid(X, Y)
R = np.sqrt(X**2 + Y**2)
Z = ((R**2 - 1)**2) * (R  1.25)
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet) ax.set_zlim3d(0, 1) 
#plt.setp(ax.get_xticklabels(), visible=False)
ax.set_xlabel(r'$\phi_\mathrm{real}$')
ax.set_ylabel(r'$\phi_\mathrm{im}$')
ax.set_zlabel(r'$V(\phi)$')
ax.set_xticks([])
plt.show()

--
View this message in context: 
http://old.nabble.com/Polar-3D-plot--tp27937798p27937798.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [CJK] can create png but not eps

2010-03-18 Thread Michael Droettboom
David wrote:
 Dear Michael,

 On 17/03/10 20:34, Michael Droettboom wrote:

 I have tried

 import matplotlib
 matplotlib.use('GtkCairo')

 as you suggested, but they had no effect whatsoever. Even the error
 output is the same.
 I'm surprised that isn't having any effect. The Cairo backend should not
 be running any code in backend_ps.py -- where the source of the error
 is. If you put backend: GtkCairo in your matplotlibrc, does that work?

 No, in fact, after adding that line to matplotlibrc the CJK isn't even 
 rendered in the png anymore! *

 My error message has changed:

 In [1]: run dea.py
 /usr/lib/pymodules/python2.6/matplotlib/backends/backend_gtk.py:614: 
 DeprecationWarning: Use the new widget gtk.Tooltip
   self.tooltips = gtk.Tooltips()
This is just a warning, and a benign one.  It is not an exception as before.

 (this with backend: GtkCairo in matplotlibrc and the following two 
 lines in my dea.py:

 import matplotlib
 matplotlib.use('GtkCairo')

 Incidentally, if I uncomment those two lines, then the (Western) font 
 of my graph actually changes.
I'm completely stumped by this.  The font rendering does look slightly 
different in the Cairo backend vs. the Agg backends, but I wouldn't 
expect major differences -- the font choice itself should be the same.  
I do see in the matplotlibrc that you attached that the TkAgg backend 
is being specified, not GtkCairo.

I am able to get the Cairo backend to work just fine using matplotlib 
0.99.0.  What version of cairo and pycairo do you have installed?

 What version of matplotlib are you running?

 In [2]: matplotlib.__version__
 Out[2]: '0.99.0'

 Note: in line 327 and 328 of the matplotlibrc I have added

 ps.fonttype=42
 pdf.fonttype=42

 I haven taken those out again, because I got an error message.
The error message may be related to using '=' rather than a ':'.  In any 
case, these settings don't affect by the Cairo backend so should have no 
effect.

I think this is just a problem related to configuration.  Once you get 
the Cairo backend selected (and confirm that is the case), then 
hopefully all will work.

Mike

 I continue to be at a loss!

 David

 * I had the same problem yesterday, I solved it by reinstalling a 
 backup of matplotlibrc. Weird.



 whereas I have uncommented

 pdf.fonttype : 3

 Any ideas? I would most welcome any hint and suggestion!
 I don't think these settings will resolve the problem -- either font
 type (42 or 3) still expects glyph names.

 Mike




 On 17/03/10 04:15, Michael Droettboom wrote:
 The font you are using (SimHei) does not have any glyph names -- these
 are used in the Postscript backend to refer to glyphs outside of the
 ASCII range. More specifically, it looks like it has at least one
 invalid glyph name (glyph names can only contain ASCII characters) --
 loading it in FontForge complains about this. I haven't come across 
 such
 a font before, but maybe that's common in CJK fonts. I don't know. I'm
 looking through the spec to find a way that glyphs can be referenced
 without a name, but I'm not finding one. Note, the PDF backend has the
 same issue.

 Do you have the same problem if you remove SimHei from the
 font.sans-serif list and thus use Adobe Song Std instead? (I was 
 able
 to find an online download of SimHei to test with, but not Adobe Song
 Std).

 As a workaround, the Cairo backend seems to handle this font just 
 fine.
 You can add

 import matplotlib
 matplotlib.use('GtkCairo')

 to the top of your script.

 Mike

 David wrote:
 Hello everybody,

 I have a final problem with my graph. As a last step I produce an
 *.eps file that I use in conjunction with LaTeX.

 Here is the last part of my code:

 # plt.title('Title')
 xlab = plt.xlabel(u'输入 1')
 #xlab.set_position((0.2, 0.1))
 ylab = plt.ylabel(u'输入 2')
 plt.grid(True)
 plt.subplots_adjust(bottom=0.2)
 plt.show()
 plt.savefig('dea.eps')


 plt.show() produces the correct output,

 but

 plt.savefig('dea.eps') produces an error (the error message is
 attached).

 The error is clearly linked to the Chinese, as it runs through if I
 take the Chinese out of the code.
 Also, plt.savefig('dea.png') works fine.

 Could anyone indicate where I would have to look for the mistake? The
 matplotlibrc should be fine, but I am not sure.

 Your help would be greatly appreciated!

 Many thanks,

 David





  



 --
  



 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
  



 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 

Re: [Matplotlib-users] Polar 3D plot?

2010-03-18 Thread Jeff Klukas
The code below works perfectly.  I think this should be included as an
mplot3d codex.  I'll look into what's required to submit a new example
to the documentation.

Thanks Armin!

|| Jeff Klukas, Research Assistant, Physics
|| University of Wisconsin -- Madison
|| jeff.klu...@gmail | jeffyklu...@aim | jeffklu...@skype
|| http://www.hep.wisc.edu/~jklukas/



On Thu, Mar 18, 2010 at 9:42 AM, Armin Moser
armin.mo...@student.tugraz.at wrote:
 Hi,

 you can create your supporting points on a regular r, phi grid and
 transform them then to cartesian coordinates:

 from mpl_toolkits.mplot3d import Axes3D
 import matplotlib
 import numpy as np
 from matplotlib import cm
 from matplotlib import pyplot as plt
 step = 0.04
 maxval = 1.0
 fig = plt.figure()
 ax = Axes3D(fig)

 # create supporting points in polar coordinates
 r = np.linspace(0,1.25,50)
 p = np.linspace(0,2*np.pi,50)
 R,P = np.meshgrid(r,p)
 # transform them to cartesian system
 X,Y = R*np.cos(P),R*np.sin(P)

 Z = ((R**2 - 1)**2)
 ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
 ax.set_zlim3d(0, 1)
 ax.set_xlabel(r'$\phi_\mathrm{real}$')
 ax.set_ylabel(r'$\phi_\mathrm{im}$')
 ax.set_zlabel(r'$V(\phi)$')
 ax.set_xticks([])
 plt.show()

 hth
 Armin


 klukas schrieb:
 I'm guessing this is currently impossible with the current mplot3d
 functionality, but I was wondering if there was any way I could generate a
 3d graph with r, phi, z coordinates rather than x, y, z?

 The point is that I want to make a figure that looks like the following:
 http://upload.wikimedia.org/wikipedia/commons/7/7b/Mexican_hat_potential_polar.svg

 Using the x, y, z system, I end up with something that has long tails like
 this:
 http://upload.wikimedia.org/wikipedia/commons/4/44/Mecanismo_de_Higgs_PH.png

 If I try to artificially cut off the data beyond some radius, I end up with
 jagged edges that are not at all visually appealing.

 I would appreciate any crazy ideas you can come up with.

 Thanks,
 Jeff

 P.S. Code to produce the ugly jaggedness is included below:

 ---
 from mpl_toolkits.mplot3d import Axes3D
 import matplotlib
 import numpy as np
 from matplotlib import cm
 from matplotlib import pyplot as plt

 step = 0.04
 maxval = 1.0
 fig = plt.figure()
 ax = Axes3D(fig)
 X = np.arange(-maxval, maxval, step)
 Y = np.arange(-maxval, maxval, step)
 X, Y = np.meshgrid(X, Y)
 R = np.sqrt(X**2 + Y**2)
 Z = ((R**2 - 1)**2) * (R  1.25)
 ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
 ax.set_zlim3d(0, 1)
 #plt.setp(ax.get_xticklabels(), visible=False)
 ax.set_xlabel(r'$\phi_\mathrm{real}$')
 ax.set_ylabel(r'$\phi_\mathrm{im}$')
 ax.set_zlabel(r'$V(\phi)$')
 ax.set_xticks([])
 plt.show()



 --
 Armin Moser
 Institute of Solid State Physics
 Graz University of Technology
 Petersgasse 16
 8010 Graz
 Austria
 Tel.: 0043 316 873 8477


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Polar 3D plot?

2010-03-18 Thread Armin Moser
Hi,

you can create your supporting points on a regular r, phi grid and
transform them then to cartesian coordinates:

from mpl_toolkits.mplot3d import Axes3D
import matplotlib
import numpy as np
from matplotlib import cm
from matplotlib import pyplot as plt
step = 0.04
maxval = 1.0
fig = plt.figure()
ax = Axes3D(fig)

# create supporting points in polar coordinates
r = np.linspace(0,1.25,50)
p = np.linspace(0,2*np.pi,50)
R,P = np.meshgrid(r,p)
# transform them to cartesian system
X,Y = R*np.cos(P),R*np.sin(P)

Z = ((R**2 - 1)**2)
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
ax.set_zlim3d(0, 1)
ax.set_xlabel(r'$\phi_\mathrm{real}$')
ax.set_ylabel(r'$\phi_\mathrm{im}$')
ax.set_zlabel(r'$V(\phi)$')
ax.set_xticks([])
plt.show()

hth
Armin


klukas schrieb:
 I'm guessing this is currently impossible with the current mplot3d
 functionality, but I was wondering if there was any way I could generate a
 3d graph with r, phi, z coordinates rather than x, y, z?  
 
 The point is that I want to make a figure that looks like the following:
 http://upload.wikimedia.org/wikipedia/commons/7/7b/Mexican_hat_potential_polar.svg
 
 Using the x, y, z system, I end up with something that has long tails like
 this:
 http://upload.wikimedia.org/wikipedia/commons/4/44/Mecanismo_de_Higgs_PH.png
 
 If I try to artificially cut off the data beyond some radius, I end up with
 jagged edges that are not at all visually appealing.
 
 I would appreciate any crazy ideas you can come up with.
 
 Thanks,
 Jeff
 
 P.S. Code to produce the ugly jaggedness is included below:
 
 ---
 from mpl_toolkits.mplot3d import Axes3D
 import matplotlib
 import numpy as np
 from matplotlib import cm
 from matplotlib import pyplot as plt
 
 step = 0.04
 maxval = 1.0
 fig = plt.figure()
 ax = Axes3D(fig)
 X = np.arange(-maxval, maxval, step)
 Y = np.arange(-maxval, maxval, step)
 X, Y = np.meshgrid(X, Y)
 R = np.sqrt(X**2 + Y**2)
 Z = ((R**2 - 1)**2) * (R  1.25)
 ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
 ax.set_zlim3d(0, 1)
 #plt.setp(ax.get_xticklabels(), visible=False)
 ax.set_xlabel(r'$\phi_\mathrm{real}$')
 ax.set_ylabel(r'$\phi_\mathrm{im}$')
 ax.set_zlabel(r'$V(\phi)$')
 ax.set_xticks([])
 plt.show()
 


-- 
Armin Moser
Institute of Solid State Physics
Graz University of Technology
Petersgasse 16
8010 Graz
Austria
Tel.: 0043 316 873 8477


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Using colourmap from matplotlib

2010-03-18 Thread Ciarán Mooney
Hi,

I am trying to create an image from an array using PIL, numpy and a
colourmap from matplotlib.

I got the colourmap by using ipython and the following code

colourmap = []
for i in xrange(256):
r,g,b,a = cm.jet(i)
r = int(round((r * 255),0))
g = int(round((g * 255),0))
b = int(round((b* 255),0))
colourmap.append((r,g,b))

The following is used to plot an array:

def array2image(array, scale=log, filename=tmp):

#   create image of the correct size
new_image = Image.new(RGB, array.shape)
#   scan through a matrix and use Image.putdata() to put it in.
x_size, y_size = array.shape
largest = array.max()
a_list = array.ravel()
new_list = []

for x in a_list:
if x == 0:
new_list.append((0,0,0))
else:
value = (log(x)/log(largest))*255
value = int(round(value,0))
value = blues_colourmap[value]
#print value
new_list.append(value)

new_image.putdata(new_list)

new_image.save(filename+.bmp)

The image that is outputted is certainly correct for the data, however
it is just no where near as pretty as the image you get from using

plt.imshow(am_array)

I'd like to get something that looks the same. I don't think the
problems are because of the colourmap but rather because of my log
scaling. Could someone please explain how matplotlib scales the image
to make it look so nice?

Regards,

Ciarán

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] ask.scipy.org is online

2010-03-18 Thread Gökhan Sever
Hello,

Please tolerate my impatience for being the first announcing the new
discussion platform :) and my cross-posting over the lists.

The new site is beating at ask.scipy.org . David Warde-Farley is moving the
questions from the old-site at advice.mechanicalkern.com (announced at
SciPy09 by Robert Kern)

We welcome you to join the discussions there. I have kicked-off the new
questions chain by
http://ask.scipy.org/en/topic/11-what-is-your-favorite-numpy-feature
(Also cross-posted at
http://stackoverflow.com/questions/2471872/what-is-your-favorite-numpy-featureto
pull more attention to ask.scipy)

Please share your questions and comments, and have fun with your
discussions.

-- 
Gökhan
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] ask.scipy.org is online

2010-03-18 Thread Chloe Lewis

Oh, nice.

I've been flagging particularly useful-looking answers on the  
matplotlib mailing list for a while; I have four or five hundred  
marked. I don't want to do all the cleanup to make them an inoculant  
for a new site, but perhaps they would be useful for people to do a  
few each or throw in their own favorites?


modulo concerns over attribution, etc
Chloe



On Mar 18, 2010, at 18 Mar, 10:20 AM, Gökhan Sever wrote:


Hello,

Please tolerate my impatience for being the first announcing the new  
discussion platform :) and my cross-posting over the lists.


The new site is beating at ask.scipy.org . David Warde-Farley is  
moving the questions from the old-site at advice.mechanicalkern.com  
(announced at SciPy09 by Robert Kern)


We welcome you to join the discussions there. I have kicked-off the  
new questions chain by http://ask.scipy.org/en/topic/11-what-is-your-favorite-numpy-feature
(Also cross-posted at http://stackoverflow.com/questions/2471872/what-is-your-favorite-numpy-feature 
 to pull more attention to ask.scipy)


Please share your questions and comments, and have fun with your  
discussions.


--
Gökhan
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users



Chloe Lewis
Graduate student, Amundson Lab
Ecosystem Sciences
137 Mulford Hall
Berkeley, CA  94720-3114
http://nature.berkeley.edu/~chlewis







--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plot single vector with alpha

2010-03-18 Thread ---
Hello,

I am trying to plot multiple intersecting lines from a given 
array. In order to visualize the amount of crossing points I am
setting a certain alpha. However the crossings do not get darker as I
expected.

That is what I tried::

import numpy as np
import matplotlib.pyplot as plt

x = np.random.randn(1000)
y = np.random.randn(1000)

plt.plot(x, y, alpha=.2, lw=1)
plt.show()


What is the right way to do it?


Thanks  cheers,
Moritz

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] figure: centering data and plot.svg borders

2010-03-18 Thread tomislav_ma...@gmx.com
Thanks, adding the axes ([0,0,1,1]) helped! 
:)
I'll just be careful so that my calculation domain 
is from 0 - 1 in x and y direction, this is something
I have to do anyway. This will definitely work!

Thanks again, 
Tomislav
- Original Message -
From: Friedrich Romstedt
Sent: 03/17/10 07:18 PM
To: tomislav_ma...@gmx.com
Subject: Re: [Matplotlib-users] figure: centering data and plot.svg borders

Maybe:

from matplotlib import pyplot as plt

figureOne = plt.figure()
axesOne = figureOne.add_axes([0, 0, 1, 1])
axesOne.plot([-1, 1], [-2, 2])
axesOne.plot([-2, 2], [-1, 1])

axesOne.set_xlim((-3, 3))
axesOne.set_ylim((-3, 3))
figureOne.set_figwidth(2)
figureOne.set_figheight(2)

plt.savefig(Friedrich.png)

Friedrich
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] toolbar

2010-03-18 Thread Gökhan Sever
On Thu, Mar 18, 2010 at 7:01 AM, Philippe Crave philippe.cr...@gmail.comwrote:

 Hello,

 the following will display a figure with a plot. the figure will embed
 the classic toolbar.

 import matplotlib.pyplot as plt
 import numpy as np
 x=np.arange(0, 1, 0.1)
 fig = plt.figure()
 ax = fig.add_subplot(111)
 ax.plot(x)
 plt.show()

 from there, is it possible to add new buttons to the toolbar ? with
 new fonction ?
 or do I have to embed everythong in wxPython, GTK or others ?

 thank you,
 Philippe


Hi Pierre Raybaut a nice extension for what you are asking. You will need to
use Qt4Agg backend to use it. The code is at
http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/lib/matplotlib/backends/qt4_editor/

He doesn't seem like planning to add more onto this extension (
http://code.google.com/p/spyderlib/issues/detail?id=136)

This said, his code is easy to read and you should easily be able to extend
it according to your need.


-- 
Gökhan
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting boolean/logical data type

2010-03-18 Thread Friedrich Romstedt
2010/3/4 Timo Heine timo.he...@gmail.com:
 Basically what I want to do is to draw a horizontal line with relative y
 co-ordinates and absolute xmin and xmax co-ordinate. Then I could draw a
 line when a bit is high and have it always in plot area even when zooming
 etc. Like axhline(...) but with relative y and absolute x
 co-ordinates.

I found a better solution candidate now, but I don't know whether it works:

import matplotlib.transforms
import matplotlib.lines

create Axes instance by calling fig.add_axes() or fig.add_subplot()

trans = matplotlib.transforms.blended_transform_factory(axes.transData,
axes.transAxes)
line = matplotlib.lines.Line2D([xmin, xmax], [yrel, yrel], transform =
trans, whatever like color = 'r')
line.y_isdata = False
axes.add_line(line)

The code is taken from axes.py:Axes.axhline() with some alterations.

Friedrich

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Using colourmap from matplotlib

2010-03-18 Thread Friedrich Romstedt
2010/3/18 Ciarán Mooney general.moo...@googlemail.com:
value = (log(x)/log(largest))*255

Just two thoughts:

1) I doubt the statement cited above is not correct, as it may also
yield negative values as soon as 0  x  1.  In fact, you are
calculating log_{largest}(x).  This crosses zero for x = 1.  What I
deem correct instead, is a linear mapping of the log space (logmin,
log(largest)) onto (0, 1).  There logmin may be negative.

2) When matplotlib does the job, maybe use:

axes = fig.add_axes([0, 0, 1, 1])
axes.imshow(...)

This lets the axes fill the whole figure space, without margins.  You
can also turn off the ticks if you want.

Friedrich

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] compiling matplotlib on Snow Leopard / tar error

2010-03-18 Thread Sven Duscha


I tried to follow the instructions given on
http://blog.hyperjeff.net/?p=160
and modified the make.osx accordingly to compile matplotlib on OS X 10.6.2 
(Snow Leopard).

But after executing 
sudo make -f make.osx fetch deps mpl_build mpl_install
I get the following error message:


I had compiled and installed tar from source, so it could be that my tar is 
missing a binding, but otherwise I could do tar xfz file.tar.gz on gzip 
files. zlib and bunzip2 are also installed on my system.

If I do a cat make.osx | grep tar to find the possible location of the error 
in the makefile, I only get:

rm -rf zlib-${ZLIBVERSION}.tar.gz libpng-${PNGVERSION}.tar.bz2 \
freetype-${FREETYPEVERSION}.tar.bz2 
bdist_mpkg-${BDISTMPKGVERSION}.tar.gz \
${PYTHON} -c 'import urllib; 
urllib.urlretrieve(http://www.zlib.net/zlib-${ZLIBVERSION}.tar.gz;, 
zlib-${ZLIBVERSION}.tar.gz)'  \
${PYTHON} -c 'import urllib; 
urllib.urlretrieve(http://internap.dl.sourceforge.net/sourceforge/libpng/libpng-${PNGVERSION}.tar.bz2;,
 libpng-${PNGVERSION}.tar.bz2)' \
${PYTHON} -c 'import urllib; 
urllib.urlretrieve(http://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPEVERSION}.tar.bz2;,
 freetype-${FREETYPEVERSION}.tar.bz2)'
tar xvfz zlib-${ZLIBVERSION}.tar.gz \
tar xvfj libpng-${PNGVERSION}.tar.bz2
tar xvfj freetype-${FREETYPEVERSION}.tar.bz2 \

which doesn't give me any hint, since all this formats should be support.

Did anyone encounter this problem?
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users