[Matplotlib-users] How do I set grid spacing?

2012-04-03 Thread Ben Harrison
I create my figure in my (non-interactive) script like so:

import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(...)

Then I want to set the spacing of y grid to 50 units (axis units). Do I 
need a method of the matplotlib.axis.Axis, or matplotlib.axes.Axes (or 
are these the same??), or something else?

Ben.


--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] assigning a plot object to a figure

2012-04-03 Thread Emmanuel Mayssat
Although this work, I lose the position of the axes.
How can I reposition the axes2 which was at 221 in fig2, to 221 in fig1 ?





 From: Emmanuel Mayssat 
To: Eric Firing ; "matplotlib-users@lists.sourceforge.net" 
 
Sent: Monday, April 2, 2012 3:20 PM
Subject: Re: [Matplotlib-users] assigning a plot object to a figure
 

Well, not sure if that is supported, but I found a way !:
    [...]

    self.fig1 = Figure(figsize=(width, height), dpi=dpi)
    self.fig2 = Figure(figsize=(width, height), dpi=dpi)
    self.axes1 = self.fig1.add_subplot(223)
    self.axes2 = self.fig2.add_subplot(221)

    [...]
    self.axes2.plot([0,1])
(1) self.axes2.set_figure(self.fig1)
(2) self.fig1.add_axes(self.axes2)

Note that (1) and (2) are required in that order!
From the code above, if I show the fig1, then I see axes1 and axes2 on the 
figure


Summary:
I created the axes2 independently of fig1

PS: I want to use my axes2 as an object to sent to my Qt widget (a blank 
figure/canvas)

--
Emmanuel



 From: Eric Firing 
To: matplotlib-users@lists.sourceforge.net 
Sent: Sunday, April 1, 2012 1:36 PM
Subject: Re: [Matplotlib-users] assigning a plot object to a figure
 
On 03/30/2012 01:23 PM, Emmanuel Mayssat wrote:
> Hello all,
>
> I can create a figure
> and get the corresponding axes/plots
>
> for examples:
> 1/
> fig = Figure(figsize=(width, height), dpi=dpi)
> ax = gif.add_subplot(111)
>
> 2/
> fig, ax = plt.subplots()
>
> but I would like to create my plot independently from the figure and
> assign it to a figure
>
> I code I would like to do something like this
>
> my_ax = Axes(...)
> my_ax.plot(x,y)
>
>
> ax = my_ax
>
> or
>
> my_ax.set_figure(fig)
>
> How can I create the axes/plot object independently from the figure?

As far as I can see, you can't.  The figure is deeply embedded in the 
Axes object; that's why the figure is an argument in Axes.__init__().

> Better yet, how can I assign an axe to a
 figure?

I don't think you can.  It looks to me like Axes.set_figure should be 
clearly marked as a private method, not to be used except in 
Axes.__init__().

Short of a major refactoring of mpl, I think you will need to find some 
other way of accomplishing your ultimate aim.

Eric

> --
> Emmanuel

--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Trouble installing on OSX 10.7

2012-04-03 Thread Elliot Saba
Hello, I am also having trouble installing matplotlib on OSX 10.7 (Homebrew
python 2.7.2, clang v2.1) and when trying to compile it from source, I get
errors regarding libpng. (https://gist.github.com/2269043) These are the
same errors I get when trying to install via pip.

I saw that there used to be errors with libpng 1.5 (which is what I have as
I am running 10.7) but they were supposedly fixed, however this does not
seem to be the case.  Does anyone have any tips for me?

Also, I do not think that I can use a binary distribution, as they do not
detect my python 2.7, and will not install to the proper site-packages
directory.  I also do not wish to install an "all-in-one" python
distribution such as EPD as I have many other packages that I wish to use
alongside matplotlib that I have already installed in my current python
setup.
-E
--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] clear figure, ax, etc

2012-04-03 Thread Emmanuel Mayssat
what does figure.clear() do ?
what about ax.clear()?

The doc is kind of sparce.
The 2 function/method above do nothing on my setup.
ax.clear() I was expecting to mean 'erase all the 2DLines'
figure.clear()  I was expecting 'hide all the axes'

Now 

figure.del_axes(self.figure.axes) 
does not do anything either

How can I remove my axes from the figure?

--
Emmanuel
--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] waitforbuttonpress DeprecationWarning

2012-04-03 Thread Jonathan Slavin
Hi,

I've been writing a routine that interactively finds fitting limits.
Some of the time it seems that doing draw() flushes the output to the
figure and some of the time it doesn't.  The only way I can reliably get
it to do that is to insert a waitforbuttonpress into the code.  However,
this raises a DeprecationWarning:
DeprecationWarning: Using default event loop until function specific to
this GUI is implemented
That of course doesn't cause any real problems, but I'd like to know how
it should be done properly since using waitforbuttonpress creates this
warning.  Or maybe it's just a warning that in the future, once the
event loop function is written for my backend (gtkagg) this function
won't necessarily exist?  I'd just as soon not use it, but I don't know
another way to force the updating of the figure.

Jon
-- 
__
Jonathan D. Slavin  Harvard-Smithsonian CfA
jsla...@cfa.harvard.edu 60 Garden Street, MS 83
phone: (617) 496-7981   Cambridge, MA 02138-1516
 cell: (781) 363-0035   USA
__


--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] installing basemap

2012-04-03 Thread Jeff Whitaker
On 4/3/12 3:09 AM, David Craig wrote:
> Hi again,
> So I removed everything and started again ( with version 1-0-2 :) )
> but am still having trouble, GEOS_DIR seems to be set correctly but I
> get the following error when trying to make the GEOS library with,
>
> sudo make; make install
>
> make[3]: Entering directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src'
> test -z "/home/davcra/lib" || /bin/mkdir -p "/home/davcra/lib"
>   /bin/sh ../libtool   --mode=install /usr/bin/install -c   libgeos.la
> '/home/davcra/lib'
> libtool: install: /usr/bin/install -c .libs/libgeos-3.3.1.so
> /home/davcra/lib/libgeos-3.3.1.so
> libtool: install: (cd /home/davcra/lib&&  { ln -s -f libgeos-3.3.1.so
> libgeos.so || { rm -f libgeos.so&&  ln -s libgeos-3.3.1.so libgeos.so;
> }; })
> libtool: install: /usr/bin/install -c .libs/libgeos.lai
> /home/davcra/lib/libgeos.la
> libtool: install: /usr/bin/install -c .libs/libgeos.a 
> /home/davcra/lib/libgeos.a
> libtool: install: chmod 644 /home/davcra/lib/libgeos.a
> libtool: install: ranlib /home/davcra/lib/libgeos.a
> libtool: finish:
> PATH="/usr/ncl_files/bin:/usr/ncl_files/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/davcra/.local/bin:/home/davcra/bin:/sbin"
> ldconfig -n /home/davcra/lib
> --
> Libraries have been installed in:
> /home/davcra/lib
>
> If you ever happen to want to link against installed libraries
> in a given directory, LIBDIR, you must either use libtool, and
> specify the full pathname of the library, or use the `-LLIBDIR'
> flag during linking and do at least one of the following:
> - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
>   during execution
> - add LIBDIR to the `LD_RUN_PATH' environment variable
>   during linking
> - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
> - have your system administrator add LIBDIR to `/etc/ld.so.conf'
>
> See any operating system documentation about shared libraries for
> more information, such as the ld(1) and ld.so(8) manual pages.
> --
> make[3]: Nothing to be done for `install-data-am'.
> make[3]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src'
> make[2]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src'
> make[1]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src'
> Making install in capi
> make[1]: Entering directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi'
> make[2]: Entering directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi'
> test -z "/home/davcra/lib" || /bin/mkdir -p "/home/davcra/lib"
>   /bin/sh ../libtool   --mode=install /usr/bin/install -c
> libgeos_c.la '/home/davcra/lib'
> libtool: install: warning: relinking `libgeos_c.la'
> libtool: install: (cd /home/davcra/basemap-1.0.2/geos-3.3.1/capi;
> /bin/sh /home/davcra/basemap-1.0.2/geos-3.3.1/libtool  --tag CXX
> --mode=relink g++ -DGEOS_INLINE -pedantic -Wall -ansi -Wno-long-long
> -ffloat-store -g -O2 -version-info 8:1:7 -no-undefined -o libgeos_c.la
> -rpath /home/davcra/lib libgeos_c_la-geos_c.lo
> libgeos_c_la-geos_ts_c.lo ../src/libgeos.la )
> mv: cannot move `libgeos_c.so.1.7.1' to `libgeos_c.so.1.7.1U': Permission 
> denied
> libtool: install: error: relink `libgeos_c.la' with the above command
> before installing it
> make[2]: *** [install-libLTLIBRARIES] Error 1
> make[2]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi'
> make[1]: *** [install-am] Error 2
> make[1]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi'
> make: *** [install-recursive] Error 1
>
> any ideas??
> thanks
> D

David:  Seems like a permissions problem?

Any reason you're not using the libgeos yum package?

-Jeff
>
> On 3/31/12 5:48 AM, David Craig wrote:
>> Hi, I previously installed basemap by using the yum command. This
>> installed version 0.99.4. I want to install the latest version so I
>> can use shaded relief etc. This may be more of a linux problem but as
>> I am more familiar with python than linux I thought someone here may
>> be able to help.
>> Following the website instructions
>> (http://matplotlib.github.com/basemap/users/installing.html) I
>> downloaded the latest version and untarred it. Then in the basemap
>> directory (which contains geos-3.2.0) I try to set the environment
>> variable GEOS_DIR to point to the location of libgeos_c and geos_c.h.
>> I use the find command to locate the files,
>> /find / -name geos_c.h/ returns the location of that file as
>> //usr/lib/basemap-1.0.1/geos-3.2.0/capi/geos_c.h/
>> and
>> /find / -name libgeos*/
>> returns
>> //libgeos_c_la-geos_c.Plo
>> /usr/lib/libgeos-3.3.1.so
>> /usr/lib/libgeos_c.so.1.7.1
>> /usr/lib/libgeos_c.so.1/
>> so I set GEOS_DIR to /usr/lib(not sure if this is correct).
>> I then cd to the basemap directory and run,
>> python setup.py install
>> [davcra@... basemap-1.0.1]$ sudo python setup.py install

Re: [Matplotlib-users] installing basemap

2012-04-03 Thread David Craig
Hi again,
So I removed everything and started again ( with version 1-0-2 :) )
but am still having trouble, GEOS_DIR seems to be set correctly but I
get the following error when trying to make the GEOS library with,

sudo make; make install

make[3]: Entering directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src'
test -z "/home/davcra/lib" || /bin/mkdir -p "/home/davcra/lib"
 /bin/sh ../libtool   --mode=install /usr/bin/install -c   libgeos.la
'/home/davcra/lib'
libtool: install: /usr/bin/install -c .libs/libgeos-3.3.1.so
/home/davcra/lib/libgeos-3.3.1.so
libtool: install: (cd /home/davcra/lib && { ln -s -f libgeos-3.3.1.so
libgeos.so || { rm -f libgeos.so && ln -s libgeos-3.3.1.so libgeos.so;
}; })
libtool: install: /usr/bin/install -c .libs/libgeos.lai
/home/davcra/lib/libgeos.la
libtool: install: /usr/bin/install -c .libs/libgeos.a /home/davcra/lib/libgeos.a
libtool: install: chmod 644 /home/davcra/lib/libgeos.a
libtool: install: ranlib /home/davcra/lib/libgeos.a
libtool: finish:
PATH="/usr/ncl_files/bin:/usr/ncl_files/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/davcra/.local/bin:/home/davcra/bin:/sbin"
ldconfig -n /home/davcra/lib
--
Libraries have been installed in:
   /home/davcra/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
 during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
 during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
--
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src'
make[2]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src'
make[1]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src'
Making install in capi
make[1]: Entering directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi'
make[2]: Entering directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi'
test -z "/home/davcra/lib" || /bin/mkdir -p "/home/davcra/lib"
 /bin/sh ../libtool   --mode=install /usr/bin/install -c
libgeos_c.la '/home/davcra/lib'
libtool: install: warning: relinking `libgeos_c.la'
libtool: install: (cd /home/davcra/basemap-1.0.2/geos-3.3.1/capi;
/bin/sh /home/davcra/basemap-1.0.2/geos-3.3.1/libtool  --tag CXX
--mode=relink g++ -DGEOS_INLINE -pedantic -Wall -ansi -Wno-long-long
-ffloat-store -g -O2 -version-info 8:1:7 -no-undefined -o libgeos_c.la
-rpath /home/davcra/lib libgeos_c_la-geos_c.lo
libgeos_c_la-geos_ts_c.lo ../src/libgeos.la )
mv: cannot move `libgeos_c.so.1.7.1' to `libgeos_c.so.1.7.1U': Permission denied
libtool: install: error: relink `libgeos_c.la' with the above command
before installing it
make[2]: *** [install-libLTLIBRARIES] Error 1
make[2]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi'
make[1]: *** [install-am] Error 2
make[1]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi'
make: *** [install-recursive] Error 1

any ideas??
thanks
D

On 3/31/12 5:48 AM, David Craig wrote:
> Hi, I previously installed basemap by using the yum command. This
> installed version 0.99.4. I want to install the latest version so I
> can use shaded relief etc. This may be more of a linux problem but as
> I am more familiar with python than linux I thought someone here may
> be able to help.
> Following the website instructions
> (http://matplotlib.github.com/basemap/users/installing.html) I
> downloaded the latest version and untarred it. Then in the basemap
> directory (which contains geos-3.2.0) I try to set the environment
> variable GEOS_DIR to point to the location of libgeos_c and geos_c.h.
> I use the find command to locate the files,
> /find / -name geos_c.h/ returns the location of that file as
> //usr/lib/basemap-1.0.1/geos-3.2.0/capi/geos_c.h/
> and
> /find / -name libgeos*/
> returns
> //libgeos_c_la-geos_c.Plo
> /usr/lib/libgeos-3.3.1.so 
> /usr/lib/libgeos_c.so.1.7.1
> /usr/lib/libgeos_c.so.1/
> so I set GEOS_DIR to /usr/lib(not sure if this is correct).
> I then cd to the basemap directory and run,
> python setup.py install
> [davcra@... basemap-1.0.1]$ sudo python setup.py install
> [sudo] password for davcra:
> checking for GEOS lib in /root 
> checking for GEOS lib in /usr 
> checking for GEOS lib in /usr/local 
> checking for GEOS lib in /sw 
> checking for GEOS lib in /opt 
> checking for GEOS lib in /opt/local 
>
> Can't find geos library . Please set the
> environm