Skip to content

axisartist incompatible with autofmt_xdate #602

Closed
@ukch

Description

@ukch

Compare the results of the following two code samples:

from pylab import *

fig = figure()
ax = fig.add_subplot(111)
ax.bar(range(3), [10, 20, 30])
ax.set_xticks(range(3))
ax.set_xticklabels(["supercalifragilisticexpialidocious",
                    "eventhoughthesoundofitissomethingquiteatrocious",
                    "ifyousayitloudenoughyouresuretosoundprecocious"])
fig.autofmt_xdate()
show()
from pylab import *
import mpl_toolkits.axisartist as AA

fig = figure()
ax = fig.add_subplot(AA.Subplot(fig, 111))
ax.bar(range(3), [10, 20, 30])
ax.set_xticks(range(3))
ax.set_xticklabels(["supercalifragilisticexpialidocious",
                    "eventhoughthesoundofitissomethingquiteatrocious",
                    "ifyousayitloudenoughyouresuretosoundprecocious"])
fig.autofmt_xdate()
show()

(The only difference between the samples is that the second one is using mpl_toolkits.axisartist)

The first example formats the tick labels so that they appear diagonally and thus do not overlap each other. The second does not.

I noticed on the AxisGrid page (http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/index.html) the following message:

axes_grid and axisartist (but not axes_grid1) uses a custom Axes class (derived from the mpl’s original Axes class). As a side effect, some commands (mostly tick-related) do not work. Use axes_grid1 to avoid this, or see how things are different in axes_grid and axisartist (LINK needed)

Although this describes a problem simoilar to the one I'm seeing, it is not very helpful as it does not suggest any alternatives. (For the record, I am using axisartist so that I can configure the shape/colour of the axis border)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions