Re: [Matplotlib-users] zoomed in detail box

2012-09-13 Thread darkside
Exactly, changing (0.5, 0.5) to something like  (0.6, 0.5) has no effect in
my side.

My python version is: 2.7.2
and matplotlib: 1.1.0

So maybe is a version problem, but it's the work computer so I can't update
easily anything. I will try other computer.

Thank you all for your help,
Illa


2012/9/12 Dale Chayes 

> [replying only to the list -Dale]
>
> On Sep 12, 2012, at 07:02 , Jae-Joon Lee wrote:
>
> > Your code works as expected in my side.
>
> I wasn't quite sure what to expect, but based on Jae-Joon's note:
>
> > So, changing (0.5, 0.5) to something like  (0.6, 0.5) has no effect in
> > your side?
>
> It seems to work on my installation. I actually changed to (0.3,0.5) which
> made a nice view.
>
> > Hmm, what is you matplotlib version?
>
> OS X 10.7.4 using python and tools from fink:
> i   python27 1:2.7.3-1
> i   python27-shlibs  1:2.7.3-1
> i   matplotlib-basemap-py27  1.0.2-1
> i   matplotlib-py27  1.1.1-1
> i   numpy-py27   1.6.1-1
>
> Thanks to the folks who make this work,
> -Dale
>
>
> > Maybe this is a bug in old version of matplotlib.
> >
> > Regards,
> >
> > -JJ
> >
> >
> > On Wed, Sep 12, 2012 at 6:16 PM, darkside 
> wrote:
> >> Thank you for your help.
> >>
> >> A simple example that doesn't work for me is:
> >> 
> >> import pylab as p
> >> import numpy as np
> >> from mpl_toolkits.axes_grid.inset_locator import zoomed_inset_axes
> >> from mpl_toolkits.axes_grid.inset_locator import mark_inset
> >> from mpl_toolkits.axes_grid.anchored_artists import AnchoredSizeBar
> >> from matplotlib.ticker import MaxNLocator
> >>
> >> fig = p.figure(figsize=(12,8))
> >> ax = p.subplot(111)
> >>
> >> z = p.arange(0,1.415,0.01)
> >> d = z**2+np.random.random(len(z))
> >>
> >> ax.plot(z,d,'ro',label='text')
> >>
> >> p.xlabel('z',fontsize=18)
> >> p.ylabel('Luminosity distance',fontsize=18)
> >> p.grid(True)
> >>
> >> axins = zoomed_inset_axes(ax,
> >> 3,bbox_to_anchor=(0.5,0.5),bbox_transform=ax.figure.transFigure, loc=2)
> >>
> >>
> >> axins.plot(z,d,'r.')
> >>
> >> ax.legend(loc=2,bbox_to_anchor=(1,1))
> >>
> >> x,y = (0.86,1.3)
> >> x2,y2 = (1,1.7)
> >> axins.set_xlim(x,x2)
> >> axins.set_ylim(y,y2)
> >> axins.tick_params(axis='both',labelsize=12)
> >> axins.xaxis.set_major_locator(MaxNLocator(2))
> >> axins.yaxis.set_major_locator(MaxNLocator(3))
> >>
> >> mark_inset(ax,axins,loc1=1,loc2=3, fc="none", ec="0.5")
> >>
> >> p.draw()
> >> p.show()
> >> ---
> >> The "bbox_to_anchor" label is supposed to move the zoomed axis, but it
> does
> >> nothing, no matter what two numbers I place there.
> >> I guess that I miss something, but I can't figure out what. I really
> >> appreciate your help.
> >>
> >> Best regards,
> >> Illa
> >>
> >>
> >>
> >> 2012/9/5 Jae-Joon Lee 
> >>>
> >>> On Mon, Aug 20, 2012 at 10:50 PM, darkside 
> >>> wrote:
>  I am using zoomed_inset_axes, but the default position overlaps the
>  yticks
>  and the parent axe ticks, so I am trying:
>  axins = zoomed_inset_axes(ax,
>  3,bbox_to_anchor(0.5,1),bbox_transform=ax.figure.transFigure, loc=2)
> >>>
> >>> This is supposed to work, and my quick test did work. Can you post a
> >>> complete but simple exampl?
> >>>
> >>> Regards,
> >>>
> >>> -JJ
> >>
> >>
> >
> >
> --
> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's security and
> > threat landscape has changed and how IT managers can respond. Discussions
> > will include endpoint security, mobile security and the latest in malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > ___
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> --
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_

Re: [Matplotlib-users] linestyles in matplotlib.pyplot.plot

2012-09-13 Thread Goutam Paul
Can we use the markers as alternatives for linestyles?
Consider the following in sage:

Suppose I have defined f(x) for a range already, say by the following:

x = np.arange(0,1,0.001)

import matplotlib.pyplot as plt

plt.plot(x,f(x), color='magenta', linestyle='--', linewidth=4,
label="$f(x)$")

I want to know the equivalent syntax for '++' marker for the same plot of
f(x) against (x).

On Thu, Sep 13, 2012 at 1:02 AM, Damon McDougall
wrote:

> On Wed, Sep 12, 2012 at 11:31 PM, Goutam Paul 
> wrote:
> > It seems that there are only five line-styles:
> >
> > "-" (solid) – default
> > "--" (dashed)
> > "-." (dash dot)
> > ":" (dotted)
> > "None" or " " or "" (nothing)
> >
> > What if I want to have more linestyles? Say, ++, **, xx, ~~, etc. Is it
> > possible to have user-defined linestyles? How?
> >
>
> User-defined line styles is difficult. There is an open github issue
> on this topic: https://github.com/matplotlib/matplotlib/issues/346
>
> Though, porting some of the existing markers over as linestyles would
> be a nice addition, I think.
>
> --
> Damon McDougall
> http://www.damon.is-a-geek.com
> B2.39
> Mathematics Institute
> University of Warwick
> Coventry
> West Midlands
> CV4 7AL
> United Kingdom
>
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Font compatibility issue with Adobe Illustrator and MPL PDF's

2012-09-13 Thread florisvb
I'm trying to get my pdf outputs from matplotlib to work properly in
illustrator, but keep having the issue that illustrator does not recognize
the computer modern fonts (eg. CMR10 etc). Everything else seems to work
perfectly.

I'm running matplotlib (1.1.1) in ubuntu precise, and illustrator (CS3) on
my mac. I installed the fonts-cmu package on my ubuntu machine, and I have
the cm fonts installed in illustrator (eg. cmr10 etc. as well as CMU Serif
etc). I've been using the following options in matplotlib for pdf rendering,
and haven't been able to make the fonts work in illustrator:

backend: Agg (also tried pdf)
usedistiller: xpdf
font.family: serif
font.serif: CMU Serif
text.usetex: True
text.latex.unicode: True (also tried the default)

After some searching it seemed like I should try the Pgf backend project,
which supports xelatex:
https://github.com/pwuertz

But after importing that pgf backend with:

import matplotlib as mpl
mpl.use("module://backend_pgf")

then importing matplotlib.pyplot yields this error:

from matplotlib.cbook import check_output
ImportError: cannot import name check_output

All I could find after search was that I needed python 2.7+... but I am
using python 2.7.3.

Any suggestions for how to get my matplotlib/pdf fonts to work properly in
Illustrator would be much appreciated... via whatever method is easiest!

Thanks,

- Floris







--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Font-compatibility-issue-with-Adobe-Illustrator-and-MPL-PDF-s-tp38904.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Font compatibility issue with Adobe Illustrator and MPL PDF's

2012-09-13 Thread Michael Droettboom
Have you tried setting pdf.fonttype to "42", which will include the font 
verbatim rather than trying to subset it?  That may help with 
illustrator.  You may also have better luck importing an SVG into 
Illustrator.

Mike

On 09/13/2012 02:46 AM, florisvb wrote:
> I'm trying to get my pdf outputs from matplotlib to work properly in
> illustrator, but keep having the issue that illustrator does not recognize
> the computer modern fonts (eg. CMR10 etc). Everything else seems to work
> perfectly.
>
> I'm running matplotlib (1.1.1) in ubuntu precise, and illustrator (CS3) on
> my mac. I installed the fonts-cmu package on my ubuntu machine, and I have
> the cm fonts installed in illustrator (eg. cmr10 etc. as well as CMU Serif
> etc). I've been using the following options in matplotlib for pdf rendering,
> and haven't been able to make the fonts work in illustrator:
>
> backend: Agg (also tried pdf)
> usedistiller: xpdf
> font.family: serif
> font.serif: CMU Serif
> text.usetex: True
> text.latex.unicode: True (also tried the default)
>
> After some searching it seemed like I should try the Pgf backend project,
> which supports xelatex:
> https://github.com/pwuertz
>
> But after importing that pgf backend with:
>
> import matplotlib as mpl
> mpl.use("module://backend_pgf")
>
> then importing matplotlib.pyplot yields this error:
>
> from matplotlib.cbook import check_output
> ImportError: cannot import name check_output
>
> All I could find after search was that I needed python 2.7+... but I am
> using python 2.7.3.
>
> Any suggestions for how to get my matplotlib/pdf fonts to work properly in
> Illustrator would be much appreciated... via whatever method is easiest!
>
> Thanks,
>
> - Floris
>
>
>
>
>
>
>
> --
> View this message in context: 
> http://matplotlib.1069221.n5.nabble.com/Font-compatibility-issue-with-Adobe-Illustrator-and-MPL-PDF-s-tp38904.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
> --
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] error installing basemap

2012-09-13 Thread Michael Rawlins


Following instructions here:

http://matplotlib.org/basemap/users/installing.html

Got this error and termination after issuing python setup.py install from the 
basemap directory.


src/_proj.c:4:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall 
-Wstrict-prototypes -fPIC -Isrc 
-I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 
-c src/_proj.c -o build/temp.linux-i686-2.7/src/_proj.o" failed with exit 
status 1



I'm running a new installation of Ubuntu 12.04. I installed Python and 
Matplotlib through package manager. Several examples tested fine. I see no 
Python.h file on my system. Thanks in advance for suggestions.

MR--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] error installing basemap

2012-09-13 Thread Michael Droettboom
You need to also install the python development package (python-dev), 
which contains the headers.


Mike

On 09/13/2012 02:06 PM, Michael Rawlins wrote:


Following instructions here:

http://matplotlib.org/basemap/users/installing.html

Got this error and termination after issuing python setup.py install 
from the basemap directory.


src/_proj.c:4:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv 
-O2 -Wall -Wstrict-prototypes -fPIC -Isrc 
-I/usr/lib/python2.7/dist-packages/numpy/core/include 
-I/usr/include/python2.7 -c src/_proj.c -o 
build/temp.linux-i686-2.7/src/_proj.o" failed with exit status 1



I'm running a new installation of Ubuntu 12.04. I installed Python and 
Matplotlib through package manager. Several examples tested fine. I 
see no Python.h file on my system. Thanks in advance for suggestions.


MR



--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


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


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] error installing basemap

2012-09-13 Thread Michael Rawlins





 From: Michael Droettboom 
To: matplotlib-users@lists.sourceforge.net 
Sent: Thursday, September 13, 2012 2:09 PM
Subject: Re: [Matplotlib-users] error installing basemap
 

You need to also install the python development package (python-dev), which 
contains the headers.  

Mike



OK basemap installed.  Thanks. But I'm getting an error running a script that 
worked with previous installation(s) of python, matplotlib, and basemap. The 
error:

user@comsys:~>python map2_TempDiff_4panels.py
Traceback (most recent call last):
  File "map2_TempDiff_4panels.py", line 27, in 
    from mpl_toolkits.basemap import  NetCDFFile
ImportError: cannot import name NetCDFFile


I installed python-mpltoolkits.basemap from package manager, before testing my 
script.

MR







>
>
>--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
>
>___
Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/matplotlib-users 

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] sharex with different tick labels

2012-09-13 Thread Daniel Welling
Greetings, all.

I have an issue: I have several axes stacked in a column with a common time
vector on each x-axis.  Each plot is a contour, so overplotting is not an
option.  In a perfect world, I want the following:
1) The subplots are tightly spaced such that with ax.grid() activated, the
grid lines appear continuous.  This makes comparing simultaneous
characteristics between subplots very easy.
2) The subplots are linked via the "sharex" keyword so I can move them all
in unison.
3) Only the bottommost subplot has x tick labels; on other plots, the long
time-formatted labels stick out of the left and right of the plots.

Items 2 and 3 are contradictory: if I turn off tick labels (e.g.
ax.set_xticklabels('')) on one axes, the others turn off as well, including
the bottom axes.  That is bad.
Does anyone know of a good workaround for this?

Thanks for your help.

-dw
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] sharex with different tick labels

2012-09-13 Thread Francesco Montesano
Hi Daniel,

2012/9/13 Daniel Welling 
>
> Greetings, all.
>
> I have an issue: I have several axes stacked in a column with a common time 
> vector on each x-axis.  Each plot is a contour, so overplotting is not an 
> option.  In a perfect world, I want the following:
> 1) The subplots are tightly spaced such that with ax.grid() activated, the 
> grid lines appear continuous.  This makes comparing simultaneous 
> characteristics between subplots very easy.
> 2) The subplots are linked via the "sharex" keyword so I can move them all in 
> unison.
> 3) Only the bottommost subplot has x tick labels; on other plots, the long 
> time-formatted labels stick out of the left and right of the plots.
>
> Items 2 and 3 are contradictory: if I turn off tick labels (e.g. 
> ax.set_xticklabels('')) on one axes, the others turn off as well, including 
> the bottom axes.  That is bad.
> Does anyone know of a good workaround for this?

To obtain what you want you have to set the tick labels invisible is
the axes where you don't want them to show up.
>From http://matplotlib.org/examples/pylab_examples/shared_axis_demo.html:
setp( ax.get_xticklabels(), visible=False)

As the axis are shared, the ticklabels are also shared, so setting
them to "", erase them from all the axes.
I hope that this helps.

Cheers,
Francesco


>
> Thanks for your help.
>
> -dw
>
> --
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] error installing basemap

2012-09-13 Thread Michael Rawlins






 From: Michael Droettboom 
To: matplotlib-users@lists.sourceforge.net 
Sent: Thursday, September 13, 2012 2:09 PM
Subject: Re: [Matplotlib-users] error installing basemap
 

You need to also install the python development package (python-dev), which 
contains the headers.  

Mike






 From: Michael Rawlins 
To: Michael Droettboom ; 
"matplotlib-users@lists.sourceforge.net" 
 
Sent: Thursday, September 13, 2012 3:11 PM
Subject: Re: [Matplotlib-users] error installing basemap
ailing list Matplotlib-users@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


OK basemap installed.  Thanks. But I'm getting an error running a script that 
worked with previous installation(s) of python, matplotlib, and basemap. The 
error:

user@comsys:~>python map2_TempDiff_4panels.py
Traceback (most recent call last):
  File "map2_TempDiff_4panels.py", line 27, in 
    from mpl_toolkits.basemap import  NetCDFFile
ImportError: cannot import name NetCDFFile


I installed python-mpltoolkits.basemap from package manager, before testing my 
script.

MR


An update:  My test script, which works with previously, now gets past the 
header initializations. Here they are:

import sys,getopt
from mpl_toolkits.basemap import Basemap, shiftgrid, cm 
#from mpl_toolkits.basemap import  NetCDFFile
from Scientific.IO.NetCDF import NetCDFFile
from pylab import *
import  matplotlib.pyplot as plt


Notr clear why the first import NetCDFFile statement does not work. Farther 
down the script, the code stops on this statement:

data.missing_value=-9.99

There error to standard output:

Traceback (most recent call last):
  File "map2_TempDiff_4panels.py", line 266, in 
    data.missing_value=-9.99
IOError: netcdf: write access to read-only file




 



--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] sharex with different tick labels

2012-09-13 Thread Sterling Smith
Daniel,

I found that I came across this often, so I created three functions (one for 
sharing x, one for y, and one for both).  In looking over them right now, there 
may be some inconsistencies between their style, but the idea is there. I am 
pasting them below in case they are useful to someone else.  The original ideas 
came from figure.autofmt_xdate.

-Sterling

def autofmt_sharexy(fig=None):
 if fig==None:
  fig = gcf()
 for a in fig.axes:
  if a.is_first_col():
   if not a.is_first_row():
a.get_yticklabels()[-1].set_visible(False)
  else:
   for yl in a.get_yticklabels():
yl.set_visible(False)
   a.set_ylabel('')
  if not a.is_last_row():
   for xl in a.get_xticklabels():
xl.set_visible(False)
   a.set_xlabel('')
  else:
   if not a.is_last_col():
a.get_xticklabels()[-1].set_visible(False)
 subplots_adjust(hspace=0,wspace=0)

def autofmt_sharey(trim_xlabel=True,fig=None):
 if fig==None:
  fig = gcf()
 from matplotlib.ticker import MaxNLocator
 for a in fig.axes:
  if a.is_first_col():
   if not a.is_first_row():
a.get_yticklabels()[-1].set_visible(False)
  else:
   for yl in a.get_yticklabels():
yl.set_visible(False)
   a.set_ylabel('')
   if trim_xlabel:
a.get_xticklabels()[0].set_visible(False)
  if not trim_xlabel:
   a.xaxis.set_major_locator(MaxNLocator(6))
   xtl = a.get_xticklabels()
   setp(xtl[0::2],visible=False)
 subplots_adjust(wspace=0)


def autofmt_sharex(fig=None):
   if fig==None:
fig = gcf()
   nax=len(fig.get_axes())
   if nax==0: return
   try:
  nr=fig.axes[0].numRows
  nc=fig.axes[0].numCols
   except:
  print 'Unable to determine numRows,numCols'
  return
   def is_last_row(n):
  if n>nax-nc-1:
 return True
  else:
 return False
   for i,ax in enumerate(fig.axes):
  if not is_last_row(i):
 for xt in ax.get_xticklabels(): xt.set_visible(False)
 ax.set_xlabel('')

-Sterling

On Sep 13, 2012, at 1:23PM, Daniel Welling wrote:

> Greetings, all.
> 
> I have an issue: I have several axes stacked in a column with a common time 
> vector on each x-axis.  Each plot is a contour, so overplotting is not an 
> option.  In a perfect world, I want the following:
> 1) The subplots are tightly spaced such that with ax.grid() activated, the 
> grid lines appear continuous.  This makes comparing simultaneous 
> characteristics between subplots very easy.
> 2) The subplots are linked via the "sharex" keyword so I can move them all in 
> unison.
> 3) Only the bottommost subplot has x tick labels; on other plots, the long 
> time-formatted labels stick out of the left and right of the plots.
> 
> Items 2 and 3 are contradictory: if I turn off tick labels (e.g. 
> ax.set_xticklabels('')) on one axes, the others turn off as well, including 
> the bottom axes.  That is bad.
> Does anyone know of a good workaround for this?
> 
> Thanks for your help.
> 
> -dw
> --
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. 
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] error installing basemap

2012-09-13 Thread Jeff Whitaker

On 9/13/12 2:34 PM, Michael Rawlins wrote:




*From:* Michael Droettboom 
*To:* matplotlib-users@lists.sourceforge.net
*Sent:* Thursday, September 13, 2012 2:09 PM
*Subject:* Re: [Matplotlib-users] error installing basemap

You need to also install the python development package (python-dev), 
which contains the headers.


Mike





*From:* Michael Rawlins 
*To:* Michael Droettboom ; 
"matplotlib-users@lists.sourceforge.net" 


*Sent:* Thursday, September 13, 2012 3:11 PM
*Subject:* Re: [Matplotlib-users] error installing basemap
ailing list Matplotlib-users@lists.sourceforge.net 
 
https://lists.sourceforge.net/lists/listinfo/matplotlib-users



OK basemap installed.  Thanks. But I'm getting an error running a 
script that worked with previous installation(s) of python, 
matplotlib, and basemap. The error:


user@comsys:~>python map2_TempDiff_4panels.py 


Traceback (most recent call last):
  File "map2_TempDiff_4panels.py", line 27, in 
from mpl_toolkits.basemap import NetCDFFile
ImportError: cannot import name NetCDFFile


I installed python-mpltoolkits.basemap from package manager, before 
testing my script.


MR


An update:  My test script, which works with previously, now gets past 
the header initializations. Here they are:


import sys,getopt
from mpl_toolkits.basemap import Basemap, shiftgrid, cm
#from mpl_toolkits.basemap import NetCDFFile
from Scientific.IO.NetCDF import NetCDFFile
from pylab import *
import  matplotlib.pyplot as plt


Notr clear why the first import NetCDFFile statement does not work. 
Farther down the script, the code stops on this statement:


data.missing_value=-9.99

There error to standard output:

Traceback (most recent call last):
  File "map2_TempDiff_4panels.py", line 266, in 
data.missing_value=-9.99
IOError: netcdf: write access to read-only file



Michael:  The NetCDFFile function was deprecated a few releases back, 
and recently removed.  If you have netcdf4-python installed you can do


from netCDF4 import Dataset as NetCDFFile

and the script should work as before.

Regarding the second error, you must open the file for write access 
(mode='w') if you want to add attributes to the data variables.


-Jeff
--
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] error installing basemap

2012-09-13 Thread Michael Rawlins





 From: Jeff Whitaker 
To: matplotlib-users@lists.sourceforge.net 
Cc: rawlin...@yahoo.com 
Sent: Thursday, September 13, 2012 9:44 PM
Subject: Re: [Matplotlib-users] error installing basemap
 

On 9/13/12 2:34 PM, Michael Rawlins wrote:


>
>
>
>
>
> From: Michael Droettboom 
>To: matplotlib-users@lists.sourceforge.net 
>Sent: Thursday, September 13, 2012 2:09 PM
>Subject: Re: [Matplotlib-users] error installing basemap
>
>
>You need to also install the python development package (python-dev), which 
>contains the headers.  
>
>Mike
>
>
>
>
>
>
>
>
> From: Michael Rawlins 
>To: Michael Droettboom ; 
>"matplotlib-users@lists.sourceforge.net" 
> 
>Sent: Thursday, September 13, 2012 3:11 PM
>Subject: Re: [Matplotlib-users] error installing basemap
>ailing list Matplotlib-users@lists.sourceforge.net 
>https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>OK basemap installed.  Thanks. But I'm
getting an error running a script that
worked with previous installation(s) of
python, matplotlib, and basemap. The error:
>
>user@comsys:~>python map2_TempDiff_4panels.py
>Traceback (most recent call last):
>  File "map2_TempDiff_4panels.py", line 27,
in 
>    from mpl_toolkits.basemap import 
NetCDFFile
>ImportError: cannot import name NetCDFFile
>
>
>I installed python-mpltoolkits.basemap from
package manager, before testing my script.
>
>MR
>
>
>An update:  My test script, which works with
previously, now gets past the header
initializations. Here they are:
>
>import sys,getopt
>from mpl_toolkits.basemap import Basemap,
shiftgrid, cm 
>#from mpl_toolkits.basemap import 
NetCDFFile
>from Scientific.IO.NetCDF import NetCDFFile
>from pylab import *
>import  matplotlib.pyplot as plt
>
>
>Notr clear why the first import NetCDFFile
statement does not work. Farther down the
script, the code stops on this statement:
>
>data.missing_value=-9.99
>
>There error to standard output:
>
>Traceback (most recent call last):
>  File "map2_TempDiff_4panels.py", line 266,
in 
>    data.missing_value=-9.99
>IOError: netcdf: write access to read-only
file
>
>
Michael:  The NetCDFFile function was deprecated a few releases
back, and recently removed.  If you have netcdf4-python installed
you can do

from netCDF4 import Dataset as NetCDFFile

and the script should work as before.

Regarding the second error, you must open the file for write access
(mode='w') if you want to add attributes to the data variables.

-Jeff


Jeff,

No I don't have netCDF4 installed. It's not in the package manager. Wasn't sure 
if there would be a conflict with python-netcdf that's installed. Guess that's 
the reverse interface. Now I'm having some trouble compiling netcdf4-python 
from sources following:

http://code.google.com/p/netcdf4-python/wiki/UbuntuInstall

The configure ended in error:

checking whether the C compiler works... no
configure: error: in `/home/rawlins/Downloads/netcdf-4.2.1.1':
configure: error: C compiler cannot create executables
  

Mike--
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Problem with axvline in gridspec with log Y axis

2012-09-13 Thread Scott Lasley
I get an error when trying to use axvline in a gridspec subplot when the Y axis 
is set to log scale in matplotlib 1.3.x (and I think recent 1.2.x versions) 
from github under python 2.7.3 and OS X 10.8.1.  This worked with matplotlib 
versions from github earlier this year.  Here is a simple code snippet to 
reproduce the problem, and the error that is generated.  The vertical line is 
drawn in the vsw sublot if I comment out the dens.axvline line.  The problem 
seems to be caused by the log scale in the dens subplot.

Any help is appreciated,
Scott

---
import matplotlib as mpl
import matplotlib.dates
import matplotlib.pyplot as plt
import numpy as np
import datetime as dt

starttime = dt.datetime(2012,9,12,20,15)
stoptime = starttime + dt.timedelta(hours=1)
fig = plt.figure(1,figsize=(480.0/72.0, 620.0/72.0), dpi=72)
gs = mpl.gridspec.GridSpec(4, 1, height_ratios=[1.,1.,1.,.67], top=.95, 
bottom=0.10, left=0.12, hspace=0.12)
vsw = plt.subplot(gs[0], label="vsw", autoscale_on=True, xlim=[starttime, 
stoptime])
vsw.plot_date(mpl.dates.drange(starttime, stoptime, dt.timedelta(minutes=10)), 
np.random.random(6))
dens = plt.subplot(gs[1], label="dens", autoscale_on=True, xlim=[starttime, 
stoptime], yscale='log')
dens.plot_date(mpl.dates.drange(starttime, stoptime, dt.timedelta(minutes=10)), 
np.random.random(6))
vsw.axvline(dt.datetime(2012,9,12,20,30))
dens.axvline(dt.datetime(2012,9,12,20,30))
plt.show()

---
ValueErrorTraceback (most recent call last)
 in ()
 15 dens.plot_date(mpl.dates.drange(starttime, stoptime, 
dt.timedelta(minutes=10)), np.random.random(6))
 16 vsw.axvline(dt.datetime(2012,9,12,20,30))
---> 17 dens.axvline(dt.datetime(2012,9,12,20,30))
 18 plt.show()

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.7-intel.egg/matplotlib/axes.pyc
 in axvline(self, x, ymin, ymax, **kwargs)
   3571 self.transData, self.transAxes)
   3572 l = mlines.Line2D([x,x], [ymin,ymax] , transform=trans, 
**kwargs)
-> 3573 self.add_line(l)
   3574 self.autoscale_view(scalex=scalex, scaley=False)
   3575 return l

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.7-intel.egg/matplotlib/axes.pyc
 in add_line(self, line)
   1504 line.set_clip_path(self.patch)
   1505 
-> 1506 self._update_line_limits(line)
   1507 if not line.get_label():
   1508 line.set_label('_line%d' % len(self.lines))

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.7-intel.egg/matplotlib/axes.pyc
 in _update_line_limits(self, line)
   1525 # identify the transform to go from line's coordinates
   1526 # to data coordinates
-> 1527 trans_to_data = line_trans - self.transData
   1528 
   1529 # if transData is affine we can use the cached non-affine 
component

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.7-intel.egg/matplotlib/transforms.pyc
 in __sub__(self, other)
   1204 return self + other.inverted()
   1205 else:
-> 1206 raise ValueError('It is not possible to compute transA - 
transB '
   1207  'since transB cannot be inverted and there 
is no '
   1208  'shortcut possible.')

ValueError: It is not possible to compute transA - transB since transB cannot 
be inverted and there is no shortcut possible.



--
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] error installing basemap

2012-09-13 Thread Michael Rawlins








 From: Jeff Whitaker 
To: matplotlib-users@lists.sourceforge.net 
Cc: rawlin...@yahoo.com 
Sent: Thursday, September 13, 2012 9:44 PM
Subject: Re: [Matplotlib-users] error installing basemap
 


Michael:  The NetCDFFile function was deprecated a few releases back, and 
recently removed.  If you have netcdf4-python installed you can do

from netCDF4 import Dataset as NetCDFFile

and the script should work as before.

Regarding the second error, you must open the file for write access
(mode='w') if you want to add attributes to the data variables.

-Jeff



From: Michael Rawlins 
To: Jeff Whitaker ; 
"matplotlib-users@lists.sourceforge.net" 
 
Sent: Thursday, September 13, 2012 10:28 PM
Subject: Re: [Matplotlib-users] error installing basemap

Making some progress. Following here:

http://code.google.com/p/netcdf4-python/wiki/UbuntuInstall

I've installed HDF5 after installing build-essential package. With just gcc 
installed I got an error.

The ./configure in netcdf4 directory failed, but completed with 
--disable-netcdf-4. I went ahead anyway hoping I don't need netCDF-4 formats or 
the additional netCDF-4 functions. Besides that issue, what's also not clear is 
where is setup.py file for the last step. It is not in the netcdf directory 
after the make install finished.  I assume netcdf-python package will not 
conflict with the python-netcdf and netcdf versions installed through package 
manager.  

Mike




--
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users--
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users