Re: [Matplotlib-users] griddata returns nan

2009-07-23 Thread plankton



plankton wrote:
> 
> Greetings all,
> 
> I rotate a vector field and than I tried to interpolate it to a new grid
> using griddata. 
> 
> CODE:
> 
> x_grid_unique = unique(x_grid)
> y_grid_unique = unique(y_grid)
> x_meshgrid,  y_meshgrid =   meshgrid(x_grid_unique, y_grid_unique)
> x_rot_meshgrid = reshape(x_rot,  [ len(x_meshgrid[:, 0]),
> len(x_meshgrid[0, :])] )
> y_rot_meshgrid = reshape(y_rot,  [ len(x_meshgrid[:, 0]),
> len(x_meshgrid[0, :])] )
> u_rot_meshgrid = reshape(u_rot,  [ len(x_meshgrid[:, 0]),
> len(x_meshgrid[0, :])] )
> v_rot_meshgrid = reshape(v_rot,  [ len(x_meshgrid[:, 0]),
> len(x_meshgrid[0, :])] )
> u_interpolate = griddata(x_rot,  y_rot, u_rot,  x_rot_meshgrid, 
> y_rot_meshgrid)
> v_interpolate = griddata(x_rot,  y_rot, v_rot,  x_rot_meshgrid, 
> y_rot_meshgrid)
> 
> 
> 
> I unfortunately griddata returns some nan (It seems that there are
> multiple occurrences of the same [X,Y] pair in the data). In matlab you
> can use griddata with additional options  e.g. ru =
> griddata(nx,ny,nu,rx,ry,'linear', {'QJ'}) to fix this, but this seems to
> be not possible using the griddata function in matplotlib. Is there any
> other way to avoid a return of nan?
> 
> For any help many thanks in advance
> 
> Andreas
> 
> 
> 
> 

Problem solved more or less. Griddata produces only at the boundary of the
vector field nan, which seems to be the result of my data matrixes u and v.
They contain serveral colums and rows with zeros at the boundary, which
leads to nan at the boundary. Finaly this is not a  great problem and can be
fixed easily by adding zeros at the boundary after using griddata. 
But maybe this can be fixed otherwise e.g. using griddata with parameters,
so that it is not necessary to fix the matrix by rewriting the boundary.
Therefore, following a sample script, which demonstrates the problem. 

SAMPLE SCRIPT

--CODE--

from pylab import *

def rotate(x,  y,  angle):
x_rot = x * cos(angle) -  y * sin(angle)
y_rot = x * sin(angle) + y * cos(angle)
return  x_rot,  y_rot 

def generate_new_grid(x_rot, y_rot, x_elements,  y_elements):
xmin = min(x_rot)
xmax = max(x_rot) 
ymin = min(y_rot)
ymax = max(y_rot) 
x  = linspace(xmin, xmax, x_elements)
y = linspace(ymin, ymax, y_elements)
x_tecplot_vector = zeros(25,  float)
y_tecplot_vector = zeros(25,  float)
for i in range(5):
first = i *5
last = (i+1) * 5
x_tecplot_vector[first:last]  = x
y_tecplot_vector[first:last]   = y[i]
return x_tecplot_vector,  y_tecplot_vector 

# ###

u = zeros(25,  float)
u[12] = 1
v =  zeros(25,  float)
v[11] = 2
x =  zeros(5,  float)
y =  zeros(5,  float)
x  = linspace(1, 5, 5)
y = linspace(1, 5, 5)
x_grid,  y_grid= generate_new_grid(x, y, 5,  5)
print y_grid
# ###
angle = 0.1
x_rot,  y_rot = rotate(x_grid,  y_grid, angle)
x_elements = 5  
y_elements = 5
x_grid,  y_grid= generate_new_grid(x_rot, y_rot, x_elements,  y_elements)
u_rot,  v_rot = rotate(u,  v, angle)
x_meshgrid,  y_meshgrid =   meshgrid(x_grid, y_grid)
x_rot_meshgrid = reshape(x_grid,  [ 5, 5] )
y_rot_meshgrid = reshape(y_grid,  [ 5, 5] )
u_rot_meshgrid = reshape(u_rot,  [ 5, 5] )
u_interpolate = griddata(x_rot,  y_rot, u_rot,  x_rot_meshgrid, 
y_rot_meshgrid)
#save('test.dat',  u_interpolate)
print u_interpolate


--CODE--




-- 
View this message in context: 
http://www.nabble.com/griddata-returns-nan-tp24537481p24623042.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Basemap installation on Ubuntu 9.04 (Jaunty

2009-07-23 Thread Nicolas
-- 
_/\/¯¯\/\_ 33º49'45.24"S & 18º28'45.60"E
Dr. Nicolas Fauchereau
Senior Researcher
CSIR - NRE
Research Group: Ocean systems and climate
15 Lower Hope street, Rosebank 7700
South Africa
_/\/¯¯\/\_ 33º49'45.24"S & 18º28'45.60"E

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Basemap installation on Ubuntu 9.04 (Jaunty Jackalope)

2009-07-23 Thread Nicolas
Hi all

I was wondering if anyone managed to find / install Basemap on a i386
machine running ubuntu 9.04 (Jaunty Jackalope) ...

I've installed the debs through synaptic, and I've tried without
success to compile
Basemap (0.99), with failure at the libgeos compilation. Trying to
install "old" .deb (python-basemap_0.99-0ads1_i386.deb) complains
about python 2.6

do I have to redo all the installation (numpy etc) using an older python (2.5) ?

thanks for any advice


-- 
_/\/¯¯\/\_ 33º49'45.24"S & 18º28'45.60"E
Dr. Nicolas Fauchereau
Senior Researcher
CSIR - NRE
Research Group: Ocean systems and climate
15 Lower Hope street, Rosebank 7700
South Africa
_/\/¯¯\/\_ 33º49'45.24"S & 18º28'45.60"E

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap installation on Ubuntu 9.04 (Jaunty Jackalope)

2009-07-23 Thread Angus McMorland
2009/7/23 Nicolas :
> Hi all
>
> I was wondering if anyone managed to find / install Basemap on a i386
> machine running ubuntu 9.04 (Jaunty Jackalope) ...
>
> I've installed the debs through synaptic, and I've tried without
> success to compile
> Basemap (0.99), with failure at the libgeos compilation. Trying to
> install "old" .deb (python-basemap_0.99-0ads1_i386.deb) complains
> about python 2.6
>
> do I have to redo all the installation (numpy etc) using an older python 
> (2.5) ?

No. I have basemap 0.99.3 working with python 2.6 under Jaunty. What's
the compilation error you're getting? I can't immediately remember how
I did it (although it was not that long ago), but we can rework it
out.

Angus.
-- 
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap installation on Ubuntu 9.04 (Jaunty Jackalope)

2009-07-23 Thread Angus McMorland
2009/7/23 Angus McMorland :
> 2009/7/23 Nicolas :
>> Hi all
>>
>> I was wondering if anyone managed to find / install Basemap on a i386
>> machine running ubuntu 9.04 (Jaunty Jackalope) ...
>>
>> I've installed the debs through synaptic, and I've tried without
>> success to compile
>> Basemap (0.99), with failure at the libgeos compilation. Trying to
>> install "old" .deb (python-basemap_0.99-0ads1_i386.deb) complains
>> about python 2.6
>>
>> do I have to redo all the installation (numpy etc) using an older python 
>> (2.5) ?
>
> No. I have basemap 0.99.3 working with python 2.6 under Jaunty. What's
> the compilation error you're getting? I can't immediately remember how
> I did it (although it was not that long ago), but we can rework it
> out.

Found it, I think. I followed some instructions here [1], which are
copied below:

$ sudo apt-get install python-matplotlib python-numpy libgeos-dev
python-httplib2 python-imaging python-dev
$ tar xvfz basemap-0.99.2.tar.gz
$ cd basemap-0.99.2/
$ sudo checkinstall sudo python setup.py install

I hope that helps,

Angus.
-- 
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] speeding-up griddata()

2009-07-23 Thread Jeff Whitaker
Denis-B wrote:
> Robert C, Robert K, folks,
>
>   messing with the nice delaunay/testfuncs.py to time
> linear_interpolate_grid nn_interpolate_grid and nn_interpolate_unstructured
> in _delaunay, I see linear ~ 100 times faster than the nn_ s:
>
> # from: trigrid Ntri=1000 Ngrid=100  run: 21 Jul 2009 17:33  mac 10.4.11 ppc
>
> time: 0.027 sec trigrid: build Triangulation 1000
> time: 0.0059 sec trigrid 100 "linear"  corners: 0 1 2 1
> time: 0.5 sec trigrid 100 "nn_grid"  corners: 0 1 2 1
> time: 0.49 sec trigrid 100 "nn_unstruct"  corners: 0 1 2 1
>
> Correct me: if all 3 methods do gridpoint-to-triangle in the same way, 
> then the huge diff is in find-neighboring-triangles (6 on average ?), not in
> gridpoint-to-triangle ?
>
> This is with the _delaunay.so that comes with the mac 98.5.3 egg,
> however that was compiled (-O3 ?)
>
>
> What to do ?
>
> 1) does it matter, how many people care ? (all who believe in telekinesis,
> raise my right hand)
>
> 2) natgrid ? don't see it in matplotlib.sf.net
>
> 3) stick with fast linear, smooth the triangle planes a la 3t^2 - 2t^3  or
> fancier smoothing
>
> In any case, add griddata( ... method = "linear" / "nn" ... ) so users have
> a choice.
>   

Denis:  I have added an 'interp' keyword to griddata (svn revision 7287) 
so you can choose the faster linear interpolation with interp='linear'.  
However, for linear interpolation the output grid is assumed to be 
regular with constant dx and dy (and this is *not* checked for by griddata).

The natgrid toolkit is on the sf site under 'Files', then 
'matplotlib-toolkits'.  It is in fact slower than the Delaunay package 
included in matplotlib, but a little bit more robust for pathological cases.

-Jeff
> Can a real user or two tell us about the flow,
> with some rough numbers for Ntri Ngrid Npix --
> Ntri = nr original sample points, say 1000
> Ngrid 100 x 100
> Npix 800 x 600 ?
> (Ntri -> Ngrid slowly and accurately,
> then Ngrid -> Npix w fast inaccurate image interpolation ? hmm.)
>
> cheers
>   -- denis
>
>   


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Possible problem with mpl.axes.Axes.add_collection()

2009-07-23 Thread jorgesmbox-ml
Hi,
I have a strange problem. It seems to me it is related to 
mpl.axes.Axes.add_collection(), but I am too lost to be sure. I have a 
script for visualizing certain aspects of images, built upon many bits 
and pieces I found on the matplotlib example section. It basically lets 
me view an image from two different perspectives, that is, its usual 
representation and another one, for example a scatter plot of red versus 
green. That part is working, but I added later on the possibility to 
select a group of points in either representation and see them 
highlighted in both with the same color. That part works OK, up to the 
third selected region, but when I select the fourth something strange 
happens, as I don't see this region in any of the subplots. I represent 
the regions as collections, and add them to subplot with 
add_collection() method. The collections themselves are created ok, and 
the get_children() method even report having them, but they are not 
visible. What surprises me the most is that it is always the fourth 
selected region the one showing this problem, no matter how big or small 
are the previous ones.I tried to make a scaled down version of the 
script exhibiting the problem, but it works ok then. I could post the 
code here, but then I'll force you to go through a 300 lines script. How 
do you go about debugging these sort of problems?
As a side note, the doc tells that add_collection() returns the 
collection, when it actually returns a NoneType object.
BTW, I am using the gtk backend, ipython is started with ipython 
-gthread -pylab. Matplotlib version is 0.98.5.3

Regards,

Jorge


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] log plots do not work when using base 2

2009-07-23 Thread Michael Droettboom
I'm not able to reproduce this problem here.  Can you provide a 
standalone script that illustrates it?  Also, what version of matplotlib 
are you using?

Mike

Barnette, Daniel W wrote:
> I've written a python gui to matplotlib which allows the user to plot either 
> cartesian, semi-log, or log-log plots. Log plots can be generated for typical 
> base values except for base 2. Is this a bug, or is there some reason that 
> matplotlib does not do log plots using base 2?
>
> Using base 2, the log-log plot error is:
>
> -- begin snippet -
> Exception in Tkinter callback
> Traceback (most recent call last):
>   File "C:\python251_102507\lib\lib-tk\Tkinter.py", line 1403, in __call__
> return self.func(*args)
>   File 
> "C:\python251_102507\lib\site-packages\matplotlib\backends\backend_tkagg.
> py", line 211, in resize
> self.show()
>   File 
> "C:\python251_102507\lib\site-packages\matplotlib\backends\backend_tkagg.
> py", line 214, in draw
> FigureCanvasAgg.draw(self)
>   File 
> "C:\python251_102507\lib\site-packages\matplotlib\backends\backend_agg.py
> ", line 261, in draw
> self.figure.draw(self.renderer)
>   File "C:\python251_102507\lib\site-packages\matplotlib\figure.py", line 
> 759, i
> n draw
> for a in self.axes: a.draw(renderer)
>   File "C:\python251_102507\lib\site-packages\matplotlib\axes.py", line 1523, 
> in
>  draw
> a.draw(renderer)
>   File "C:\python251_102507\lib\site-packages\matplotlib\axis.py", line 712, 
> in
> draw
> for tick, loc, label in self.iter_ticks():
>   File "C:\python251_102507\lib\site-packages\matplotlib\axis.py", line 659, 
> in
> iter_ticks
> minorLocs = self.minor.locator()
>   File "C:\python251_102507\lib\site-packages\matplotlib\ticker.py", line 
> 1026,
> in __call__
> if len(subs) > 1 or subs[0] != 1.0:
> IndexError: index out of bounds
>
> - end snippet -
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Possible problem with mpl.axes .Axes.add_collection()

2009-07-23 Thread Jorge Scandaliaris
  writes:

> 
> Hi,
> I have a strange problem. It seems to me it is related to 
> mpl.axes.Axes.add_collection(), but I am too lost to be sure. 

Well, I haven't solved this problem yet, but it seems that the add_collection()
method is not the one at fault. It looks like the lasso widget I am using to
selct the regions is returning for the fourth region the same vertices than for
the third one. That's why I saw nothing for the fourth region when I was
actually passing the add_collection() method a valid PolyCollection. I'll keep
on looking... but why the fourth?

Jorge


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] memory leak with PyQt4 plus savefig or print_figure

2009-07-23 Thread Ralf Gommers
On Wed, Jul 22, 2009 at 6:36 AM, Alexander Baker
wrote:

>
>
> Ralph,
>
> Perhaps time to migrate to Chaco API from Enthought? not sure if there is
> Ubuntu support yet however.


Alex, I assume you did not mean to send this to the list...

Anyway, matplotlib is a central part of my application and is not going
anywhere. The next step to try to fix this issue is compiling from trunk and
seeing if anything changes. Unfortunately I do not have too much time at the
moment so it may take a while to find the problem.

Cheers,
Ralf


>
> Alex Baker
>
> http://code.enthought.com/chaco/
>
>
> Ralf Gommers-2 wrote:
> >
> > Hi,
> >
> > I am working on a PyQt4 application with some embedded MPL figures, and
> am
> > also trying to save some figures as png's without displaying them. I am
> > observing huge memory increases (10s or 100s of Mb) the moment I try to
> > save
> > a png. I reproduced the issue by combining two mpl examples,
> >
> http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_qt4.htmland
> > http://matplotlib.sourceforge.net/examples/api/agg_oo.html. Full code is
> > attached. When pressing the "save figure" button, memory usage shoots up,
> > multiple clicks keep sending it higher (although not monotonically).
>
>
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How to get ticks "out" using mpl_toolkits.axes_grid.axislines ?

2009-07-23 Thread Nicolas Pinto
Hello,

I'm trying to get the ticks "out" in the following scripts using matplotlib
svn version. Any reason why it's not working ? Should I dig deeper in
mpl_toolkits ?

# -- Script 1
# modified from
http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline3.html
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid.axislines import Subplot

plt.rc("xtick", direction="out")
plt.rc("ytick", direction="out")

fig = plt.figure(1, (3,3))

ax = Subplot(fig, 111)
fig.add_subplot(ax)

ax.axis["right"].set_visible(False)
ax.axis["top"].set_visible(False)

plt.show()

# -- EOF

# -- Script 2
# modified from
http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline2.html

import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid.axislines import SubplotZero
import numpy as np

*plt.rc("xtick", direction="out")
plt.rc("ytick", direction="out")
*
fig = plt.figure(1, (4,3))

# a subplot with two additiona axis, "xzero" and "yzero". "xzero" is
# y=0 line, and "yzero" is x=0 line.
ax = SubplotZero(fig, 1, 1, 1)
fig.add_subplot(ax)

# make xzero axis (horizontal axis line through y=0) visible.
ax.axis["xzero"].set_visible(True)
ax.axis["xzero"].label.set_text("Axis Zero")

# make other axis (bottom, top, right) invisible.
for n in ["bottom", "top", "right"]:
ax.axis[n].set_visible(False)

xx = np.arange(0, 2*np.pi, 0.01)
ax.plot(xx, np.sin(xx))

plt.show()

# -- EOF

Thanks for your help.

Best regards,

-- 
Nicolas Pinto
Ph.D. Candidate, Brain & Computer Sciences
Massachusetts Institute of Technology, USA
http://web.mit.edu/pinto
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] build requirements for matplotlib

2009-07-23 Thread Nils Wagner
Hi all,

I am confused by the build requirements for matplotlib.
I cannot find freetype 1.4

http://matplotlib.sourceforge.net/users/installing.html

The latest version is freetype 1.3.1

  http://sourceforge.net/projects/freetype/files/

Any comments ?

Nils

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] build requirements for matplotlib

2009-07-23 Thread Michael Droettboom
The latest version I see there is 2.3.9.  Is this another instance of 
the sourceforge file display bug that haunted matplotlib recently?

Mike

Nils Wagner wrote:
> Hi all,
>
> I am confused by the build requirements for matplotlib.
> I cannot find freetype 1.4
>
> http://matplotlib.sourceforge.net/users/installing.html
>
> The latest version is freetype 1.3.1
>
>   http://sourceforge.net/projects/freetype/files/
>
> Any comments ?
>
> Nils
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to get ticks "out" using mpl_toolkits.axes_grid.axislines ?

2009-07-23 Thread Jae-Joon Lee
Hi,

Thanks for reporting this.
The axes class in axes_grid toolkits uses different artists to render
ticks and ticklabels. And some of the features in the original
matplotlib won't work correctly, and the "tick direction" turned out
to be one of them.

However, I just committed a fix for this to the svn (r7292), so it
should work now.
So, please install mpl from the current svn again, and test it.
Unfortunately, while the ticks are rotated, the pad for tick labels
are not automatically adjusted.
Therefore, you may want to adjust it manually. e.g.,

ax.axis["left"].major_tick_pad = 10

I'll try to improve this in the future.

On the other hand, you may take a look at the recently added "spine"
support in the main matplotlib.

http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html

If you use spine, than all the ticks & ticklabels feature in mpl will work.

Regards,

-JJ


On Thu, Jul 23, 2009 at 3:23 PM, Nicolas Pinto wrote:
> Hello,
>
> I'm trying to get the ticks "out" in the following scripts using matplotlib
> svn version. Any reason why it's not working ? Should I dig deeper in
> mpl_toolkits ?
>
> # -- Script 1
> # modified from
> http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline3.html
> import matplotlib.pyplot as plt
> from mpl_toolkits.axes_grid.axislines import Subplot
>
> plt.rc("xtick", direction="out")
> plt.rc("ytick", direction="out")
>
> fig = plt.figure(1, (3,3))
>
> ax = Subplot(fig, 111)
> fig.add_subplot(ax)
>
> ax.axis["right"].set_visible(False)
> ax.axis["top"].set_visible(False)
>
> plt.show()
>
> # -- EOF
>
> # -- Script 2
> # modified from
> http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline2.html
>
> import matplotlib.pyplot as plt
> from mpl_toolkits.axes_grid.axislines import SubplotZero
> import numpy as np
>
> plt.rc("xtick", direction="out")
> plt.rc("ytick", direction="out")
>
> fig = plt.figure(1, (4,3))
>
> # a subplot with two additiona axis, "xzero" and "yzero". "xzero" is
> # y=0 line, and "yzero" is x=0 line.
> ax = SubplotZero(fig, 1, 1, 1)
> fig.add_subplot(ax)
>
> # make xzero axis (horizontal axis line through y=0) visible.
> ax.axis["xzero"].set_visible(True)
> ax.axis["xzero"].label.set_text("Axis Zero")
>
> # make other axis (bottom, top, right) invisible.
> for n in ["bottom", "top", "right"]:
>     ax.axis[n].set_visible(False)
>
> xx = np.arange(0, 2*np.pi, 0.01)
> ax.plot(xx, np.sin(xx))
>
> plt.show()
>
> # -- EOF
>
> Thanks for your help.
>
> Best regards,
>
> --
> Nicolas Pinto
> Ph.D. Candidate, Brain & Computer Sciences
> Massachusetts Institute of Technology, USA
> http://web.mit.edu/pinto
>
> --
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to get ticks "out" using mpl_toolkits.axes_grid.axislines ?

2009-07-23 Thread Nicolas Pinto
Thanks Jae-Joon, it's working now. And thanks for pointing me to "spine",
that's exactly what I was looking for!

Cheers,

N

On Thu, Jul 23, 2009 at 6:40 PM, Jae-Joon Lee  wrote:

> Hi,
>
> Thanks for reporting this.
> The axes class in axes_grid toolkits uses different artists to render
> ticks and ticklabels. And some of the features in the original
> matplotlib won't work correctly, and the "tick direction" turned out
> to be one of them.
>
> However, I just committed a fix for this to the svn (r7292), so it
> should work now.
> So, please install mpl from the current svn again, and test it.
> Unfortunately, while the ticks are rotated, the pad for tick labels
> are not automatically adjusted.
> Therefore, you may want to adjust it manually. e.g.,
>
> ax.axis["left"].major_tick_pad = 10
>
> I'll try to improve this in the future.
>
> On the other hand, you may take a look at the recently added "spine"
> support in the main matplotlib.
>
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html
>
> If you use spine, than all the ticks & ticklabels feature in mpl will work.
>
> Regards,
>
> -JJ
>
>
> On Thu, Jul 23, 2009 at 3:23 PM, Nicolas Pinto
> wrote:
> > Hello,
> >
> > I'm trying to get the ticks "out" in the following scripts using
> matplotlib
> > svn version. Any reason why it's not working ? Should I dig deeper in
> > mpl_toolkits ?
> >
> > # -- Script 1
> > # modified from
> >
> http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline3.html
> > import matplotlib.pyplot as plt
> > from mpl_toolkits.axes_grid.axislines import Subplot
> >
> > plt.rc("xtick", direction="out")
> > plt.rc("ytick", direction="out")
> >
> > fig = plt.figure(1, (3,3))
> >
> > ax = Subplot(fig, 111)
> > fig.add_subplot(ax)
> >
> > ax.axis["right"].set_visible(False)
> > ax.axis["top"].set_visible(False)
> >
> > plt.show()
> >
> > # -- EOF
> >
> > # -- Script 2
> > # modified from
> >
> http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline2.html
> >
> > import matplotlib.pyplot as plt
> > from mpl_toolkits.axes_grid.axislines import SubplotZero
> > import numpy as np
> >
> > plt.rc("xtick", direction="out")
> > plt.rc("ytick", direction="out")
> >
> > fig = plt.figure(1, (4,3))
> >
> > # a subplot with two additiona axis, "xzero" and "yzero". "xzero" is
> > # y=0 line, and "yzero" is x=0 line.
> > ax = SubplotZero(fig, 1, 1, 1)
> > fig.add_subplot(ax)
> >
> > # make xzero axis (horizontal axis line through y=0) visible.
> > ax.axis["xzero"].set_visible(True)
> > ax.axis["xzero"].label.set_text("Axis Zero")
> >
> > # make other axis (bottom, top, right) invisible.
> > for n in ["bottom", "top", "right"]:
> > ax.axis[n].set_visible(False)
> >
> > xx = np.arange(0, 2*np.pi, 0.01)
> > ax.plot(xx, np.sin(xx))
> >
> > plt.show()
> >
> > # -- EOF
> >
> > Thanks for your help.
> >
> > Best regards,
> >
> > --
> > Nicolas Pinto
> > Ph.D. Candidate, Brain & Computer Sciences
> > Massachusetts Institute of Technology, USA
> > http://web.mit.edu/pinto
> >
> >
> --
> >
> > ___
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> >
>



-- 
Nicolas Pinto
Ph.D. Candidate, Brain & Computer Sciences
Massachusetts Institute of Technology, USA
http://web.mit.edu/pinto
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users