[Matplotlib-users] installing basemap

2012-03-31 Thread David Craig
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@David 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
environment variable GEOS_DIR to point to the location
where geos is installed (for example, if geos_c.h
is in /usr/local/include, and libgeos_c is in /usr/local/lib,
set GEOS_DIR to /usr/local), or edit the setup.py script
manually and set the variable GEOS_dir (right after the line
that says set GEOS_dir manually here.

The problem seems to be with GEOS_DIR but I am not sure what I should set
it to.
Thanks
D
--
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


Re: [Matplotlib-users] Display problem on CentOS

2012-03-31 Thread Magician
Alexis  Eric


Thanks for your advices.
I've been trying, but I still have some problems.

I tried matplotlib.matplotlib_fname() and I found my silly mistake.
Python answered 
'/usr/local/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc'
My RC file was named .matplotlibrc.
When the prefixed dot removed, it works perfectly.

And I found to change the backends by using matplotlib.use() command.
I tried all of them, but nothing worked (with errors).

When using matplotlib.get_backend() on pre-installed python2.6,
it said 'GTKAgg' and matplotlib.pyplot.show() exactly worked.
So I tried to install PyGTK from source code, but it's fairly complicated.

Is there an easy way to install backends for additionally installed Python?
My python is v2.7.2.


Magician


On 2012/03/27, at 23:04, Alexis Praga wrote:

 You can check you are editing the correct configuration file with (in
 the Python shell) :
 import matplotlib
 matplotlib.matplotlib_fname()
 
 You can also try other backends. For a list, see :
 http://matplotlib.sourceforge.net/faq/usage_faq.html#what-is-a-backend
 
 On Tue, Mar 27, 2012 at 2:46 PM, Magician f_magic...@mac.com wrote:
 Thank you, Alexis.
 
 I try to install PyQt4 and set Qt4Agg just now, but nothing displayed.
 Ummm...what's wrong...??
 
 
 Magician
 
 
 On 2012/03/27, at 17:05, Alexis Praga wrote:
 
 I had the same problem on Debian.
 Editing the matplotlibrc (should be installed somewhere in your
 systeme) and changing the backend variable to Qt4Agg did the trick.
 
 
 
 On Tue, Mar 27, 2012 at 12:14 AM, Magician f_magic...@mac.com wrote:
 Hi.
 
 I want to install Matplotlib from source code on CentOS.
 I've been using Matplotlib for a year.
 But this is the first time for me to install CentOS by myself.
 
 I installed CentOS 6.2 in basic install option.
 Next, I installed NumPy and Matplotlib.
 .matplotlibrc isn't set.
 
 It looks successfully installed, but when I type show() command,
 nothing appears.
 I can export PNG image by using savefig() command, so maybe
 I'm using invalid backend.
 
 How can I display plots with show() command?
 
 
 Magician
 


--
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


Re: [Matplotlib-users] Copying a figure instance?

2012-03-31 Thread Tony Yu
On Fri, Mar 30, 2012 at 12:25 PM, eoj josephmeir...@gmail.com wrote:


 Basically the problem is like this. I have a relatively expensive (time
 wise)
 figure to create, specifically a map with lots of detail in it. On top of
 that, I'm  making an inset set of axes to highlight some regions. I'm
 having
 to recreate the base of the map, which is static, every time I want to make
 an inset for a different region which is taking forever. What I want to do
 is something like this:

 fig = figure()

 #do stuff that makes the expensive figure

 for region in regions:
fig2 = copy.copy(fig)
ax2 = fig.add_axes([0.1, 0.15, 0.25, 0.25])
ax2.fill(x1,y1)
savefig(region_name)
close()



 The problem is that the clf() clear figure function seems to clear the base
 of the map off, even if I try to make a copy of it inside a loop that is
 generating the insets. Also, close() seems to close fig and not fig2. Does
 this rambling make any sense, and if so, any suggestions?


If all your additions are confined to the inset axes, you can use
`fig.delaxes` to remove the axes from the figure (see example below). If
you want to save and restore, as you describe above, you should (in
principal) be able to do so with `canvas.copy_from_bbox` and
`canvas.restore_region`, but I couldn't get it to work (see bottom of the
animation cookbook http://www.scipy.org/Cookbook/Matplotlib/Animations).

Cheers,
-Tony

# ~~~ example
import numpy as np
import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.imshow(np.random.uniform(size=(10, 10)))

ax_inset = fig.add_axes([0.3, 0.3, 0.2, 0.2])
ax_inset.plot([0, 1])
plt.savefig('plot0')

fig.delaxes(ax_inset)
ax_inset = fig.add_axes([0.5, 0.5, 0.2, 0.2])
ax_inset.plot([1, 0])
plt.savefig('plot1')
# ~~~
--
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


Re: [Matplotlib-users] Matplotlib installation

2012-03-31 Thread Paul Hobson
How did you install Python 2.7? None of my windows machines have ever
hand any problem finding it when I installed from the official
binaries found at python.org.

-paul

On Fri, Mar 30, 2012 at 9:56 AM, Mateusz J Burgunder
mburgun...@wesleyan.edu wrote:
 Hello,

 I am trying to download matplot (matplotlib-1.1.0) but at the start of the
 download I get a screen that says Python version 2.7 required, which was
 not found in the registry.
 I have python 2.7. Where exactly should I save mathplotlib so that it can
 find python for the installation?

 Many thanks,
 Matt.

 --
 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


--
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


[Matplotlib-users] Subplot array and colorbar

2012-03-31 Thread Marston

Hi,

I'm trying to create a plot, with subplots where each row of x plots have a
common colorbar beneath it. Only the the top row will have titles. I've
tried creating a function to do this but I only achieve partial success.
Here is an image created in another program that I want to duplicate:

http://old.nabble.com/file/p33544950/fig.jpeg 
 
I made several functions to do this. Here's one of them:

def Plot(self,title,plist):
   for k in np.sort(self.vdic.keys()):  

  plt.subplot(5,13,self.window) 
   
  cs = plt.contourf(22,22,np.squeeze(self.vdic[k]),plist['levels'], 
 
   cmap=cm.get_cmap('jet',len(plist['levels'])-1))  
  
  plt.axis('off')   
  
  if title: plt.title(k,fontsize=tsize) 
  
  window += 1
  cbar = plt.colorbar(cax=plist['cax'],orientation='h') 
  

I've given up in getting the text on the left because every attempt using
text fails.
Now if this is a horrible way and you have a better idea, please feel free
to share.
I'm new at matplotlib and this is a great way to see how things can be done
better
and in different ways. 
-- 
View this message in context: 
http://old.nabble.com/Subplot-array-and-colorbar-tp33544950p33544950.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
--
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


Re: [Matplotlib-users] Display problem on CentOS

2012-03-31 Thread Eric Firing
On 03/31/2012 04:02 AM, Magician wrote:
 Alexis  Eric


 Thanks for your advices.
 I've been trying, but I still have some problems.

 I tried matplotlib.matplotlib_fname() and I found my silly mistake.
 Python answered 
 '/usr/local/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc'
 My RC file was named .matplotlibrc.
 When the prefixed dot removed, it works perfectly.

 And I found to change the backends by using matplotlib.use() command.
 I tried all of them, but nothing worked (with errors).

 When using matplotlib.get_backend() on pre-installed python2.6,
 it said 'GTKAgg' and matplotlib.pyplot.show() exactly worked.
 So I tried to install PyGTK from source code, but it's fairly complicated.

 Is there an easy way to install backends for additionally installed Python?
 My python is v2.7.2.

Can you find CentOS packages for any of the gui toolkits for your python 
version? pygtk, pyqt4, tkinter, wxpython--any of them?  If so, you 
should be just about set.  Only pygtk and tkinter would even require 
rebuilding mpl; pyqt4 and wxpython don't require any mpl extension code.

Eric



 Magician


 On 2012/03/27, at 23:04, Alexis Praga wrote:

 You can check you are editing the correct configuration file with (in
 the Python shell) :
 import matplotlib
 matplotlib.matplotlib_fname()

 You can also try other backends. For a list, see :
 http://matplotlib.sourceforge.net/faq/usage_faq.html#what-is-a-backend

 On Tue, Mar 27, 2012 at 2:46 PM, Magicianf_magic...@mac.com  wrote:
 Thank you, Alexis.

 I try to install PyQt4 and set Qt4Agg just now, but nothing displayed.
 Ummm...what's wrong...??


 Magician


 On 2012/03/27, at 17:05, Alexis Praga wrote:

 I had the same problem on Debian.
 Editing the matplotlibrc (should be installed somewhere in your
 systeme) and changing the backend variable to Qt4Agg did the trick.



 On Tue, Mar 27, 2012 at 12:14 AM, Magicianf_magic...@mac.com  wrote:
 Hi.

 I want to install Matplotlib from source code on CentOS.
 I've been using Matplotlib for a year.
 But this is the first time for me to install CentOS by myself.

 I installed CentOS 6.2 in basic install option.
 Next, I installed NumPy and Matplotlib.
 .matplotlibrc isn't set.

 It looks successfully installed, but when I type show() command,
 nothing appears.
 I can export PNG image by using savefig() command, so maybe
 I'm using invalid backend.

 How can I display plots with show() command?


 Magician



 --
 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


--
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


Re: [Matplotlib-users] Having trouble installing matplotlib on Mac OS X Lion

2012-03-31 Thread eoj

Hi, 

   Have you tried the EPD python installation, it works for me and includes
SciPY/Numpy/ etc. 

http://www.enthought.com/products/epd_free.php


Cheers, 
Joe



William Carithers wrote:
 
 Hi all,
 
 I had matplotlib-0.99.1.1 working with Python 2.6 on OS X v10.6(Snow
 Leopard). Today I upgraded to Lion (v10.7) and matplotlib had disappeared.
 Lion ships with Apple¹s version of Python 2.7. Even when I look back at
 Python 2.6 in the /System/Library/Frameworks/Python/Version/Python2.6, it
 seems to be gone. OK, I thought I would install matplotlib-1.0.1 in Python
 2.7 using easy_install. It failed when unable to find the headers for
 numpy
 (terminal output below). Lion comes with numpy 1.5.1 pre-installed. I
 tried
 re-installing numpy but that didn¹t help so now I¹m stuck.
 
 Any suggestions?
 
 Thanks.
 
 
 c4-2c-3-1-f0-3a:matplotlib-1.0.1 williamcarithers$ sudo easy_install
 matplotlib
 Searching for matplotlib
 Reading http://pypi.python.org/simple/matplotlib/
 Reading http://matplotlib.sourceforge.net
 Reading 
 https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0.
 1/
 Reading 
 http://sourceforge.net/project/showfiles.php?group_id=80706package_id=82474
 Reading http://sourceforge.net/project/showfiles.php?group_id=80706
 Reading 
 https://sourceforge.net/project/showfiles.php?group_id=80706package_id=8247
 4
 Reading 
 https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99
 .1/
 Reading 
 https://sourceforge.net/project/showfiles.php?group_id=80706package_id=2781
 94
 Reading 
 https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99
 .3/
 Reading 
 https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0
 Best match: matplotlib 1.0.1
 Downloading 
 http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0.1
 /matplotlib-1.0.1.tar.gz/download
 Processing matplotlib-1.0.1.tar.gz
 Running matplotlib-1.0.1/setup.py -q bdist_egg --dist-dir
 /tmp/easy_install-OI8zuY/matplotlib-1.0.1/egg-dist-tmp-3EXRXm
 basedirlist is: []
 
 BUILDING MATPLOTLIB
 matplotlib: 1.0.1
 python: 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)  [GCC
 4.2.1 (Based on Apple Inc. build 5658) (LLVM build
 2335.15.00)]
   platform: darwin
 
 REQUIRED DEPENDENCIES
  numpy: 1.5.1
 * Could not find the headers for numpy.  You may
 * need to install the development package.
 error: Setup script exited with 1
 
 --
 uberSVN's rich system and user administration capabilities and model 
 configuration take the hassle out of deploying and managing Subversion and 
 the tools developers use with it. Learn more about uberSVN and get a free 
 download at:  http://p.sf.net/sfu/wandisco-dev2dev
 
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
-- 
View this message in context: 
http://old.nabble.com/Having-trouble-installing-matplotlib-on-Mac-OS-X-Lion-tp3373p33544963.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
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


[Matplotlib-users] bar plot (autofmt_xdate and left-right margins )

2012-03-31 Thread Massimo Di Stefano

Hi All

i'm bring to do  simple bar plot formatting the xlabe as 'date' using a syntax 
like :  fig.autofmt_xdate(bottom=0.1) 
but something is wrong in my code, please have you any hints on ghow to proper 
display the dates (Year) along the x axis
and how to leave a margin on the left and on the right of the plot?   (my 
example has a margin only on the right, while the first bar is adjacent to the 
Y axis)

 
###

import numpy as np
import matplotlib.pyplot as plt

x = np.array([1969,1970,1971,1972,1973,1974])
y = np.array([-3,10,23,-4,-5,6])
data = [x,y]

print x
print y




def bar_plot(data, Yval, datamin=None, datamax=None):
 doc  
fig = plt.figure()
fig.autofmt_xdate(bottom=0.1) 
ax1 = fig.add_subplot(211)
x = data[0]
y = data[1]
if datamin != datamax != None :
x = data[0][np.where((data[0]=datamin)  (data[0]=datamax))[0]]
y = data[1][np.where((data[0]=datamin)  (data[0]=datamax))[0]]
x_p = x[np.where(y=0)[0]]
y_p = y[np.where(y=0)[0]]
x_n = x[np.where(y0)[0]]
y_n = y[np.where(y0)[0]]
ax1.bar(x_n, y_n, facecolor='b') 
ax1.bar(x_p, y_p, facecolor='r') 
ax1.grid(True)
ax1.set_xlabel('Year')
ax1.set_ylabel(Yval)
ax1.set_title(Yval)
ax1.axhline(0, color='black', lw=1)
plt.show()

bar_plot(data, 'Var', datamin=1970, datamax=1973)

###
--
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