Re: [Matplotlib-users] newbie question: type check?

2010-01-12 Thread Joshua J. Kugler
On Monday 11 January 2010, Nico Schlömer elucidated thus:
> quick question from a Python noob:
> Suppose I have an instance of an object of matplotlib, Is there any
> way to check on its type, e.g., whether it is an instance of
> matplotlib.axes.AxesSubplots?

Python's built-in 'isintance.'

isinstance(var, matplotlib.axes.AxesSubplots)

j

-- 
Joshua Kugler
Part-Time System Admin/Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/  ID 0x14EA086E

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Error with get_home()?

2010-01-12 Thread Alexander Bruy
Hi list

I develop an application which used matplotlib and there is a problem on some
computers. When home directory is simple e.g.

C:/Documents and Settings/alex/.qgis/

all works, but when home directory path contains a dot, for example

C:/Documents and Settings/compase.UWW/.qgis/

I've get an error:

Couldn't load plugin statist due an error when calling its classFactory() method

Traceback (most recent call last):
File "C:/Program Files/Quantum GIS Enceladus/./python\qgis\utils.py",
line 141, in startPlugin
plugins[packageName] = package.classFactory(iface)
File "C:/Documents and
Settings/compase.UWW/.qgis//python/plugins\statist\__init__.py", line
48, in classFactory
from statist import statistPlugin
File "C:/Documents and
Settings/compase.UWW/.qgis//python/plugins\statist\statist.py", line
37, in
import doStatist, doAbout, utils
File "C:/Documents and
Settings/compase.UWW/.qgis//python/plugins\statist\doStatist.py", line
45, in
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
File "C:\Python25\lib\site-packages\matplotlib\__init__.py", line 709, in
rcParams = rc_params()
File "C:\Python25\lib\site-packages\matplotlib\__init__.py", line 627,
in rc_params
fname = matplotlib_fname()
File "C:\Python25\lib\site-packages\matplotlib\__init__.py", line 565,
in matplotlib_fname
fname = os.path.join(get_configdir(), 'matplotlibrc')
File "C:\Python25\lib\site-packages\matplotlib\__init__.py", line 240,
in wrapper
ret = func(*args, **kwargs)
File "C:\Python25\lib\site-packages\matplotlib\__init__.py", line 439,
in _get_configdir
raise RuntimeError("Failed to create %s/.matplotlib; consider setting
MPLCONFIGDIR to a writable directory for matplotlib configuration
data"%h)
RuntimeError: Failed to create U:\/.matplotlib; consider setting
MPLCONFIGDIR to a writable directory for matplotlib configuration data

Python version:
2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]

Python path: ['C:/Program Files/Quantum GIS Enceladus/./python',
'C:/Documents and Settings/compase.UWW/.qgis//python', 'C:/Documents
and Settings/compase.UWW/.qgis//python/plugins', 'C:/Program
Files/Quantum GIS Enceladus/./python/plugins', 'C:\\Program
Files\\ArcGIS\\bin', 'C:\\Program Files\\Quantum GIS
Enceladus\\bin\\python25.zip', 'C:\\Python25\\Lib',
'C:\\Python25\\DLLs', 'C:\\Python25\\Lib\\lib-tk', 'C:\\Program
Files\\Quantum GIS Enceladus', 'C:\\Program Files\\Quantum GIS
Enceladus\\bin', 'C:\\Python25', 'C:\\Python25\\lib\\site-packages',
'C:\\Python25\\lib\\site-packages\\win32',
'C:\\Python25\\lib\\site-packages\\win32\\lib',
'C:\\Python25\\lib\\site-packages\\Pythonwin',
'C:\\Python25\\lib\\site-packages\\wx-2.8-msw-unicode', 'C:\\Program
Files\\Quantum GIS Enceladus\\python\\plugins\\fTools\\tools']

Is this a bug?

Thanks
-- 
Alexander Bruy
mailto: alexander.b...@gmail.com

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Save eps ghostscript error

2010-01-12 Thread John Reid


Jae-Joon Lee wrote:
> When you check out the svn, please try to apply the patch attached.
> 
> patch -p1 < ps_distiller.patch
> 
> I hope this solves your problem.
> 

Thanks again for quick response. I've got the svn version and applied 
the patch. Now I get this error (with ps.usedistiller : xpdf):

** (python2.5:5948): WARNING **: IPP request failed with status 1280
Error: Missing or bad Type3 CharProc entry

An eps file is generated but I can't open it with okular or evince.

Regards,
John.


--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] newbie question: type check?

2010-01-12 Thread Nico Schlömer
Hm.

print type( gca() )
print gca().__class__
print isinstance( gca(), matplotlib.axes.AxesSubplots)

yields



Traceback (most recent call last):
  File "./testfunctions.py", line 13, in 
print isinstance( a, matplotlib.axes.AxesSubplots)
AttributeError: 'module' object has no attribute 'AxesSubplots

?Nico


On Tue, Jan 12, 2010 at 6:45 AM, Joshua J. Kugler  wrote:
> On Monday 11 January 2010, Nico Schlömer elucidated thus:
>> quick question from a Python noob:
>> Suppose I have an instance of an object of matplotlib, Is there any
>> way to check on its type, e.g., whether it is an instance of
>> matplotlib.axes.AxesSubplots?
>
> Python's built-in 'isintance.'
>
> isinstance(var, matplotlib.axes.AxesSubplots)
>
> j
>
> --
> Joshua Kugler
> Part-Time System Admin/Programmer
> http://www.eeinternet.com
> PGP Key: http://pgp.mit.edu/  ID 0x14EA086E
>

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] newbie question: type check?

2010-01-12 Thread Matthias Michler
Hi Nico,

I'm sorry I cannot help you, but at least I'd like to share my findings with 
you: I find the following statements to be true:
isinstance(gca(), matplotlib.axes.SubplotBase)
isinstance(gca(), matplotlib.axes.Subplot)
isinstance(gca(), matplotlib.axes.Axes)
but there is no class 'AxesSubplot' in matplotlib.axes. I think this class is 
somehow dynamically generated from Axes and Subplot, but I have no idea how 
this works. 

Kind regards,
Matthias

On Tuesday 12 January 2010 11:40:21 Nico Schlömer wrote:
> Hm.
>
> print type( gca() )
> print gca().__class__
> print isinstance( gca(), matplotlib.axes.AxesSubplots)
>
> yields
>
> 
> 
> Traceback (most recent call last):
>   File "./testfunctions.py", line 13, in 
> print isinstance( a, matplotlib.axes.AxesSubplots)
> AttributeError: 'module' object has no attribute 'AxesSubplots
>
> ?Nico
>
> On Tue, Jan 12, 2010 at 6:45 AM, Joshua J. Kugler  
wrote:
> > On Monday 11 January 2010, Nico Schlömer elucidated thus:
> >> quick question from a Python noob:
> >> Suppose I have an instance of an object of matplotlib, Is there any
> >> way to check on its type, e.g., whether it is an instance of
> >> matplotlib.axes.AxesSubplots?
> >
> > Python's built-in 'isintance.'
> >
> > isinstance(var, matplotlib.axes.AxesSubplots)
> >
> > j
> >
> > --
> > Joshua Kugler
> > Part-Time System Admin/Programmer
> > http://www.eeinternet.com
> > PGP Key: http://pgp.mit.edu/  ID 0x14EA086E


--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] newbie question: type check?

2010-01-12 Thread Damon McDougall
Hi Nico,

If you're using IPython then you can do a cool trick. Say your your 
instantiation is called var. You can type:

var?

and it'll spit out some info about the object, including what it's an instance 
of. If you type

var??

it'll try to print out more detailed information.

Hope that helps.

Regards,
-- Damon

--
Damon McDougall
Mathematics Institute
University of Warwick
Coventry
CV4 7AL
d.mcdoug...@warwick.ac.uk

On 12 Jan 2010, at 10:40, Nico Schlömer wrote:

> Hm.
> 
> print type( gca() )
> print gca().__class__
> print isinstance( gca(), matplotlib.axes.AxesSubplots)
> 
> yields
> 
> 
> 
> Traceback (most recent call last):
>  File "./testfunctions.py", line 13, in 
>print isinstance( a, matplotlib.axes.AxesSubplots)
> AttributeError: 'module' object has no attribute 'AxesSubplots
> 
> ?Nico
> 
> 
> On Tue, Jan 12, 2010 at 6:45 AM, Joshua J. Kugler  
> wrote:
>> On Monday 11 January 2010, Nico Schlömer elucidated thus:
>>> quick question from a Python noob:
>>> Suppose I have an instance of an object of matplotlib, Is there any
>>> way to check on its type, e.g., whether it is an instance of
>>> matplotlib.axes.AxesSubplots?
>> 
>> Python's built-in 'isintance.'
>> 
>> isinstance(var, matplotlib.axes.AxesSubplots)
>> 
>> j
>> 
>> --
>> Joshua Kugler
>> Part-Time System Admin/Programmer
>> http://www.eeinternet.com
>> PGP Key: http://pgp.mit.edu/  ID 0x14EA086E
>> 
> 
> --
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev 
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] newbie question: type check?

2010-01-12 Thread Nico Schlömer
Well, I guess that's good enough for me. :)

It's a bit unfortunate that the type() function wouldn't spit out this
information, though. When for example iterating through the output of
get_children() (iterating through a list of objects of unknown classes
that is), would there be any other way (function, method?) to get more
info on the matplotlib object?

Cheers,
Nico



On Tue, Jan 12, 2010 at 12:01 PM, Matthias Michler
 wrote:
> Hi Nico,
>
> I'm sorry I cannot help you, but at least I'd like to share my findings with
> you: I find the following statements to be true:
> isinstance(gca(), matplotlib.axes.SubplotBase)
> isinstance(gca(), matplotlib.axes.Subplot)
> isinstance(gca(), matplotlib.axes.Axes)
> but there is no class 'AxesSubplot' in matplotlib.axes. I think this class is
> somehow dynamically generated from Axes and Subplot, but I have no idea how
> this works.
>
> Kind regards,
> Matthias
>
> On Tuesday 12 January 2010 11:40:21 Nico Schlömer wrote:
>> Hm.
>>
>> print type( gca() )
>> print gca().__class__
>> print isinstance( gca(), matplotlib.axes.AxesSubplots)
>>
>> yields
>>
>> 
>> 
>> Traceback (most recent call last):
>>   File "./testfunctions.py", line 13, in 
>>     print isinstance( a, matplotlib.axes.AxesSubplots)
>> AttributeError: 'module' object has no attribute 'AxesSubplots
>>
>> ?Nico
>>
>> On Tue, Jan 12, 2010 at 6:45 AM, Joshua J. Kugler 
> wrote:
>> > On Monday 11 January 2010, Nico Schlömer elucidated thus:
>> >> quick question from a Python noob:
>> >> Suppose I have an instance of an object of matplotlib, Is there any
>> >> way to check on its type, e.g., whether it is an instance of
>> >> matplotlib.axes.AxesSubplots?
>> >
>> > Python's built-in 'isintance.'
>> >
>> > isinstance(var, matplotlib.axes.AxesSubplots)
>> >
>> > j
>> >
>> > --
>> > Joshua Kugler
>> > Part-Time System Admin/Programmer
>> > http://www.eeinternet.com
>> > PGP Key: http://pgp.mit.edu/  ID 0x14EA086E
>
>
> --
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] newbie question: type check?

2010-01-12 Thread Matthias Michler
Hi Nico,

On Tuesday 12 January 2010 12:26:01 Nico Schlömer wrote:
> Well, I guess that's good enough for me. :)

Just to share my knowlegde with you: I found 
In [18]: matplotlib.axes.Subplot.__bases__
Out[18]: 
(,
 )

That is the class 'matplotlib.axes.Subplot' was inherited from SubplotBase and 
Axes. I think the name 'AxesSubplot' belongs to the class object 'Subplot', 
which is dynamically generated in the axes.py and includes the name of 
the 'mother': namely 'Axes' (see also function 'subplot_class_factory' at the 
end of matplotlib/axes.py).

> It's a bit unfortunate that the type() function wouldn't spit out this
> information, though. When for example iterating through the output of
> get_children() (iterating through a list of objects of unknown classes
> that is), would there be any other way (function, method?) to get more
> info on the matplotlib object?

I think type just uses the '__name__' of the class, which is in most cases 
really the name of the class, but I think for Subplot-instances this is a bit 
more involved because of the internal structure of matplotlib.
In[11]: matplotlib.axes.Subplot.__name__
Out[11]: 'AxesSubplot'

I would expect that the case of the Subplot-objects is somehow singular and 
all other mpl-objects can be classified using type and isinstance, but I'm 
not an mpl-expert and maybe there are more special cases.

Kind regards,
Matthias

> On Tue, Jan 12, 2010 at 12:01 PM, Matthias Michler
>
>  wrote:
> > Hi Nico,
> >
> > I'm sorry I cannot help you, but at least I'd like to share my findings
> > with you: I find the following statements to be true:
> > isinstance(gca(), matplotlib.axes.SubplotBase)
> > isinstance(gca(), matplotlib.axes.Subplot)
> > isinstance(gca(), matplotlib.axes.Axes)
> > but there is no class 'AxesSubplot' in matplotlib.axes. I think this
> > class is somehow dynamically generated from Axes and Subplot, but I have
> > no idea how this works.
> >
> > Kind regards,
> > Matthias
> >
> > On Tuesday 12 January 2010 11:40:21 Nico Schlömer wrote:
> >> Hm.
> >>
> >> print type( gca() )
> >> print gca().__class__
> >> print isinstance( gca(), matplotlib.axes.AxesSubplots)
> >>
> >> yields
> >>
> >> 
> >> 
> >> Traceback (most recent call last):
> >>   File "./testfunctions.py", line 13, in 
> >>     print isinstance( a, matplotlib.axes.AxesSubplots)
> >> AttributeError: 'module' object has no attribute 'AxesSubplots
> >>
> >> ?Nico
> >>
> >> On Tue, Jan 12, 2010 at 6:45 AM, Joshua J. Kugler
> >> 
> >
> > wrote:
> >> > On Monday 11 January 2010, Nico Schlömer elucidated thus:
> >> >> quick question from a Python noob:
> >> >> Suppose I have an instance of an object of matplotlib, Is there any
> >> >> way to check on its type, e.g., whether it is an instance of
> >> >> matplotlib.axes.AxesSubplots?
> >> >
> >> > Python's built-in 'isintance.'
> >> >
> >> > isinstance(var, matplotlib.axes.AxesSubplots)
> >> >
> >> > j
> >> >
> >> > --
> >> > Joshua Kugler
> >> > Part-Time System Admin/Programmer
> >> > http://www.eeinternet.com
> >> > PGP Key: http://pgp.mit.edu/  ID 0x14EA086E
> >
> > -
> >- This SF.Net email is sponsored by the Verizon Developer Community
> > Take advantage of Verizon's best-in-class app development support A
> > streamlined, 14 day to market process makes app distribution fast and
> > easy Join now and get one step closer to millions of Verizon customers
> > http://p.sf.net/sfu/verizon-dev2dev
> > ___
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] newbie question: type check?

2010-01-12 Thread Michael Droettboom
Matthias Michler wrote:
> I would expect that the case of the Subplot-objects is somehow singular and 
> all other mpl-objects can be classified using type and isinstance, but I'm 
> not an mpl-expert and maybe there are more special cases.
>   
Yes.  This weirdness came about because Subplot used to contain 
functionality for both the projections (how data is projected, ticked 
etc.) and positioning within the figure.  Around 0.91, these two things 
were separated out so that writing a new projection (eg. polar axes) 
didn't require reimplementing the subplot infrastructure.  The Subplot 
class was kept around as an alias for AxesSubplot (a dynamically 
generated class) backward compatibility.

As for not being able to do "isinstance(gca(), 
matplotlib.axes.SubplotAxes)" -- I'm not sure that's a problem.  It 
would help to understand the use case, but I suspect you either want 
"isinstance(gca(), matplotlib.axes.Axes)" or "isinstance(gca(), 
matplotlib.axes.SubplotBase)".

Mike
> Kind regards,
> Matthias
>
>   
>> On Tue, Jan 12, 2010 at 12:01 PM, Matthias Michler
>>
>>  wrote:
>> 
>>> Hi Nico,
>>>
>>> I'm sorry I cannot help you, but at least I'd like to share my findings
>>> with you: I find the following statements to be true:
>>> isinstance(gca(), matplotlib.axes.SubplotBase)
>>> isinstance(gca(), matplotlib.axes.Subplot)
>>> isinstance(gca(), matplotlib.axes.Axes)
>>> but there is no class 'AxesSubplot' in matplotlib.axes. I think this
>>> class is somehow dynamically generated from Axes and Subplot, but I have
>>> no idea how this works.
>>>
>>> Kind regards,
>>> Matthias
>>>
>>> On Tuesday 12 January 2010 11:40:21 Nico Schlömer wrote:
>>>   
 Hm.

 print type( gca() )
 print gca().__class__
 print isinstance( gca(), matplotlib.axes.AxesSubplots)

 yields

 
 
 Traceback (most recent call last):
   File "./testfunctions.py", line 13, in 
 print isinstance( a, matplotlib.axes.AxesSubplots)
 AttributeError: 'module' object has no attribute 'AxesSubplots

 ?Nico

 On Tue, Jan 12, 2010 at 6:45 AM, Joshua J. Kugler
 
 
>>> wrote:
>>>   
> On Monday 11 January 2010, Nico Schlömer elucidated thus:
>   
>> quick question from a Python noob:
>> Suppose I have an instance of an object of matplotlib, Is there any
>> way to check on its type, e.g., whether it is an instance of
>> matplotlib.axes.AxesSubplots?
>> 
> Python's built-in 'isintance.'
>
> isinstance(var, matplotlib.axes.AxesSubplots)
>
> j
>
> --
> Joshua Kugler
> Part-Time System Admin/Programmer
> http://www.eeinternet.com
> PGP Key: http://pgp.mit.edu/  ID 0x14EA086E
>   
>>> -
>>> - This SF.Net email is sponsored by the Verizon Developer Community
>>> Take advantage of Verizon's best-in-class app development support A
>>> streamlined, 14 day to market process makes app distribution fast and
>>> easy Join now and get one step closer to millions of Verizon customers
>>> http://p.sf.net/sfu/verizon-dev2dev
>>> ___
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>   
>
>
>
> --
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev 
> ___
> 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


--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] newbie question: type check?

2010-01-12 Thread Christopher Barker

> As for not being able to do "isinstance(gca(), 
> matplotlib.axes.SubplotAxes)" -- I'm not sure that's a problem.  It 
> would help to understand the use case, but I suspect you either want 
> "isinstance(gca(), matplotlib.axes.Axes)" or "isinstance(gca(), 
> matplotlib.axes.SubplotBase)".

You may also want to use:

issubclass(an_appropriate_superclass)

instead.

However, given the python's duck-typing semantics, you usually don't 
need to know exactly what class something is -- that's kind of the point 
of dynamic typing.

So what is it you're trying to accomplish? Maybe there is a better way.

-Chris




-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Re using a subplot on two different figures

2010-01-12 Thread dugolo

I apologize if this has been covered, but I couldn't find it by searching. 

I'm wondering how one might reuse a single subplot on two different figures.

Here's what I'm trying to do:

import matplotlib.pyplot as plt

fig1 = plt.figure()
fig2 = plt.figure()
ax1 = fig1.add_subplot(311)

#plot lots of stuff on ax1

# I thought maybe I could do something like this, but, of course, that
doesn't work.
ax2 = fig2.add_subplot(311)
ax2 = ax1

Basically, I would like to put ax1 on both fig1 and fig2 without having to
repeat all of the code for plots on ax1.

Thanks for the help!!!
-Doug


-- 
View this message in context: 
http://old.nabble.com/Reusing-a-subplot-on-two-different-figures-tp27131100p27131100.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] bar/hist plots, bottom on top or right axis

2010-01-12 Thread Renato Alves
Quoting Matthias Michler on 01/08/2010 08:00 AM:
> Hi Renato,
> 
> I think you have to flip the x-axis of the left plot by for instance
> ax1 = subplot(121, xlim=(1, 0))
> and I think than hist(data, orientation='horizontal') or manually using 
> barh-plots works fine.
> 
> Kind regards,
> Matthias

Hi Matthias,

Thanks for your tip, this solved the first problem.

But it seems the approach I was trying is not as flexible as I thought
it would be.

Right now I'm trying mpl_toolkits.axes_grid.axes_divider but I still
have a problem on locating the yaxis labels in a centered format.

Anyway this is a bit out of the scope of the initial thread.

Thanks again.

Renato

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Re using a subplot on two different figures

2010-01-12 Thread PHobson


> -Original Message-
> From: dugolo [mailto:mad...@gmail.com]
> Sent: Tuesday, January 12, 2010 9:21 AM
> To: matplotlib-users@lists.sourceforge.net
> Subject: [Matplotlib-users] Re using a subplot on two different figures
> 
> 
> I apologize if this has been covered, but I couldn't find it by
> searching.
> 
> I'm wondering how one might reuse a single subplot on two different
> figures.
> 
> Here's what I'm trying to do:
> 
> import matplotlib.pyplot as plt
> 
> fig1 = plt.figure()
> fig2 = plt.figure()
> ax1 = fig1.add_subplot(311)
> 
> #plot lots of stuff on ax1
> 
> # I thought maybe I could do something like this, but, of course, that
> doesn't work.
> ax2 = fig2.add_subplot(311)
> ax2 = ax1
> 
> Basically, I would like to put ax1 on both fig1 and fig2 without having
> to
> repeat all of the code for plots on ax1.

Doug,

I'm sure there's a slick, one-line way to do this. I don't know it either. As a 
quick work around, you could do this:
fig1 = plt.figure()
fig2 = plt.figure()
ax1 = fig1.add_subplot(311)
ax2 = fig2.add_subplot(311)
for ax in [ax1, ax2]:
# do lots of stuff to ax

At least, that's how I would do it with my very basic MPL knowledge. Hope this 
wasn't obvious to you and something you were trying to avoid.

HTH,
-Paul H.

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Re using a subplot on two different figures

2010-01-12 Thread Jae-Joon Lee
On Tue, Jan 12, 2010 at 12:21 PM, dugolo  wrote:
> Basically, I would like to put ax1 on both fig1 and fig2 without having to
> repeat all of the code for plots on ax1.
>

The Axes instances in matplotlib can only have one parent figure,
i.e., the axes cannot be shared among different figures.

But this does not necessarily imply that you have to repeat the
drawing code. Just define a function that takes an axes, or use some
control structure as suggested above.

Regards,

-JJ

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Save eps ghostscript error

2010-01-12 Thread Jae-Joon Lee
I'm afraid that there is not much I can help anymore.

Just in case, does the same error occur when my patch is not applied?

Is it an error or just a warning? If it is an error, can you post a
full traceback? I just want to know what step causes that.

Also, are you using the usetex mode? See if turning that on and off
make any difference.

Regards,

-JJ

On Tue, Jan 12, 2010 at 5:29 AM, John Reid  wrote:
>
>
> Jae-Joon Lee wrote:
>> When you check out the svn, please try to apply the patch attached.
>>
>> patch -p1 < ps_distiller.patch
>>
>> I hope this solves your problem.
>>
>
> Thanks again for quick response. I've got the svn version and applied
> the patch. Now I get this error (with ps.usedistiller : xpdf):
>
> ** (python2.5:5948): WARNING **: IPP request failed with status 1280
> Error: Missing or bad Type3 CharProc entry
>
> An eps file is generated but I can't open it with okular or evince.
>
> Regards,
> John.
>
>
> --
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Simple text style question

2010-01-12 Thread Jae-Joon Lee
On Mon, Jan 11, 2010 at 3:20 PM, Gökhan Sever  wrote:
> Another thing I noted in these images, Qt4Agg produced one looks much
> prettier to my eyes than the PS. What could be causing the jiggly rendering
> in the PS?
>

The rendering quality of the fonts depends on a lot of things.
And I think your ps file itself is okay, but the rendering application
you use is doing a poor job. For example, convert the ps file to pdf
and open in the acroread (or whatever you use).

-JJ

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Simple text style question

2010-01-12 Thread Gökhan Sever
On Tue, Jan 12, 2010 at 2:46 PM, Jae-Joon Lee  wrote:

> On Mon, Jan 11, 2010 at 3:20 PM, Gökhan Sever 
> wrote:
> > Another thing I noted in these images, Qt4Agg produced one looks much
> > prettier to my eyes than the PS. What could be causing the jiggly
> rendering
> > in the PS?
> >
>
> The rendering quality of the fonts depends on a lot of things.
> And I think your ps file itself is okay, but the rendering application
> you use is doing a poor job. For example, convert the ps file to pdf
> and open in the acroread (or whatever you use).
>

Yes, it did the job. Thanks for the tip. The fonts look also nicer in PDF.
The last interesting thing in the files, the line is rendered as blue on
PNG, however in the PS it is red.



>
> -JJ
>



-- 
Gökhan
--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev ___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] newbie question: type check?

2010-01-12 Thread Nico Schlömer
> So what is it you're trying to accomplish? Maybe there is a better way.

Well, I'm recursively iterating through the children of all objects,
starting at gcf() (and then picking up gca(), lines, axes, everything
that belongs to the plot), which is then parsed and a TikZ file is
spit out. I need the type-checking exactly when I loop through the
children of an object to be able to say "Now we have an axes object,
plot axes.".

I'm a total Python noob, so my first attempts at an implementation is
likely quite shabby:

http://win.ua.ac.be/~nschloe/other/websvn/filedetails.php?repname=matplotlib2tikz&path=%2Ftrunk%2Fmatplotlib2tikz.py

You'll find handle_children() towards the bottom of the file.

Would the type-checking as applied in there be something sensitive to
do? Also, of course, hints of *all kinds very much appreciated!

Cheers,
Nico

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Simple text style question

2010-01-12 Thread Gökhan Sever
Allright, I have another comparison.

My simple hello.ps file produced by the svn MPL vs test_idl.ps (which has a
lot plots --only for test purposes.) file produced by IDL. When I converted
the ps file to pdf (using ps2pdf tool) it gets shinier.

http://ccnworks.googlecode.com/svn/trunk/hello.ps
http://ccnworks.googlecode.com/svn/trunk/hello.pdf
http://ccnworks.googlecode.com/svn/trunk/test_idl.ps

Some technical details regarding to the files:

hello.ps
Creator: GPL Ghostscript 870 (pswrite)
Format: PS-Adobe-3.0

test_idl.ps
Creator: IDL Version 7.1 (linux x86 m32)
Format: PS-Adobe-3.0

See the formats are same. IDL's ps creator does a much better job than the
Ghostscript. (Both in terms of fonts and lines, actual frame looks nice in
both ps and pdf files.) I use Evince Document Viewer v2.28.2 to view these
files.

What could be causing this discrepancy? Is there any way to use an
alternative PS creator with MPL? or an option to increase e.g. bits per
pixel option somewhere in the configuration?

Thanks.


On Tue, Jan 12, 2010 at 2:52 PM, Gökhan Sever  wrote:

>
>
> On Tue, Jan 12, 2010 at 2:46 PM, Jae-Joon Lee wrote:
>
>> On Mon, Jan 11, 2010 at 3:20 PM, Gökhan Sever 
>> wrote:
>> > Another thing I noted in these images, Qt4Agg produced one looks much
>> > prettier to my eyes than the PS. What could be causing the jiggly
>> rendering
>> > in the PS?
>> >
>>
>> The rendering quality of the fonts depends on a lot of things.
>> And I think your ps file itself is okay, but the rendering application
>> you use is doing a poor job. For example, convert the ps file to pdf
>> and open in the acroread (or whatever you use).
>>
>
> Yes, it did the job. Thanks for the tip. The fonts look also nicer in PDF.
> The last interesting thing in the files, the line is rendered as blue on
> PNG, however in the PS it is red.
>
>
>
>>
>> -JJ
>>
>
>
>
> --
> Gökhan
>



-- 
Gökhan
--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev ___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users