Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Radek Machulka <radek.machulka@gm...>  20101018 10:44:52

Hi guys, I made a class which create a special plot in the parent figure (matplotlib.pyplot.figure) given as a argument to the __init__ method. To show more than one instance of this class in the matrix I make a grid (mpl_toolkits.axes_grid.AxesGrid) and initialize the class with proper element of this grid instead of the figure class instance. Naturely this does not work, because this grid element (mpl_toolkits.axes_grid1.axes_divider.LocatableAxes) is not inherent from the matplotlib.pyplot.figure class, so the methods are different. Problematic part of my code is line: axe2D = self.figure.add_axes(rect), where self.figure represents the 'parent area'. Do you have any idea, howto solve this incompatibility? Radek 
From: JaeJoon Lee <lee.j.joon@gm...>  20101018 11:49:56

A figure is a figure and an axes is an axes. They are NOT interchangeable. The AxesGrid essentially creates a list of axes. As you may already know, only figure class has an add_axes method. And axes can only be added to a figure. You cannot add an axes to another axes. Since I have no idea what kind of special plot your code creates, I can only suggest you to revise your code to take an axes instance as an input, not a figure instance. If you can, please post a simple, but complete code that demonstrate your problem. Regards, JJ 
From: JaeJoon Lee <lee.j.joon@gm...>  20101018 13:23:30

While you cannot add an axes to another axes, you can set position of an axes "relative to" another axes. The threads below show simple approaches. http://thread.gmane.org/gmane.comp.python.matplotlib.general/16373 http://old.nabble.com/embeddingfiguresinsideanother%28coordinates%29td22826126.html#a22832238 This may or may not work on your cases depending the complexity of your plots. Of course, if you need more control on the axes position, you may implement your own axes_locator. Regards, JJ On Mon, Oct 18, 2010 at 9:33 PM, Radek Machulka <radek.machulka@...> wrote: > That 'spacial plot' is just several simple plots placed in the 'parent > figure'. So my class just create this bunch of plots as an axes and place them > somewhere. > This is the 'plotting core' of my class: > > # plot 1 > rect1 = [a, b, c, d] # where a, b, c and d values depends on the data, ... > self.plot1 = self.figure.add_axes(rect1) > self.plot1.plot(data1) > > and the same (similar) for rest of plots (with differnt a,b,c,d values, of > course). > > So since it is not possible to place axes to another axes there is probably no > solution for my problem. > What can I probably do is create grid of figures (if figures are realy only > element where can axes be placed), but this seems not possible, or rewrite my > class using different elements for subplots instead of axes, if there is > anything... > > Well, thanks for clarifying this, I should definitely read more documentation > before I start code so complex apps. > But Thank You anyway > Radek > > Dne pondělí 18 října 2010 13:49:34 jste napsal(a): >> A figure is a figure and an axes is an axes. They are NOT >> interchangeable. The AxesGrid essentially creates a list of axes. >> >> As you may already know, only figure class has an add_axes method. And >> axes can only be added to a figure. You cannot add an axes to another >> axes. >> >> Since I have no idea what kind of special plot your code creates, I >> can only suggest you to revise your code to take an axes instance as >> an input, not a figure instance. >> >> If you can, please post a simple, but complete code that demonstrate >> your problem. >> >> Regards, >> >> JJ > 
Sign up for the SourceForge newsletter:
No, thanks