> 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 t
> 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
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
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
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 (fu
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
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 'AxesSubpl
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 'Axes
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.'
isinst
Hi,
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?
Cheers!
Nico
--
This S
10 matches
Mail list logo