gca() returns Axes

I have run into a problem related to tight_layout when building the docs, and the root of it seems to be that plt.gca() returns an Axes, not an AxesSubplot. This seems odd, since it appears that it should be equivalent to plt.subplot(1,1,1) when there is no pre-existing axes.

Does anyone see any problem with ensuring that what plt.gca() returns in this case is an AxesSubplot instance?

Eric

Correction: now I can't reproduce what I thought I was seeing; plt.gca() is returning an AxesSubplot as it should. Maybe the problem is in the axes_grid1 toolkit. It is appearing in the last figure of the tight_layout tutorial in the docs.

Eric

···

On 2012/08/21 10:21 AM, Eric Firing wrote:

I have run into a problem related to tight_layout when building the
docs, and the root of it seems to be that plt.gca() returns an Axes, not
an AxesSubplot. This seems odd, since it appears that it should be
equivalent to plt.subplot(1,1,1) when there is no pre-existing axes.

Does anyone see any problem with ensuring that what plt.gca() returns in
this case is an AxesSubplot instance?

Eric

I made a minor change to gca on Monday to address a bug. The PR was https://github.com/matplotlib/matplotlib/pull/1111

I can’t see that it should be the cause of this though.

Regards,

···

On 21 August 2012 22:40, Eric Firing <efiring@…229…> wrote:

On 2012/08/21 10:21 AM, Eric Firing wrote:

I have run into a problem related to tight_layout when building the

docs, and the root of it seems to be that plt.gca() returns an Axes, not

an AxesSubplot. This seems odd, since it appears that it should be

equivalent to plt.subplot(1,1,1) when there is no pre-existing axes.

Does anyone see any problem with ensuring that what plt.gca() returns in

this case is an AxesSubplot instance?

Eric

Correction: now I can’t reproduce what I thought I was seeing; plt.gca()

is returning an AxesSubplot as it should. Maybe the problem is in the

axes_grid1 toolkit. It is appearing in the last figure of the

tight_layout tutorial in the docs.

Eric


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-devel mailing list

Matplotlib-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

For axes which uses axes_locator, tight_layout works if the
axes_locator have associated subplotspec.
And, only allowing instance of SubplotBase is too strict.

The PR below addresses this issue.

https://github.com/matplotlib/matplotlib/pull/1170

And it will work again for the axes_grid1 cases.

Regards,

-JJ

···

On Wed, Aug 22, 2012 at 6:40 AM, Eric Firing <efiring@...229...> wrote:

Correction: now I can't reproduce what I thought I was seeing; plt.gca()
is returning an AxesSubplot as it should. Maybe the problem is in the
axes_grid1 toolkit. It is appearing in the last figure of the
tight_layout tutorial in the docs.