proplot-dev / proplot

🎨 A succinct matplotlib wrapper for making beautiful, publication-quality graphics

Home Page:https://proplot.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: xticklabels overwrites xminorticks setting

syrte opened this issue · comments

Description

xticklabels overwrites xminorticks setting

Steps to reproduce

Expected behavior with minorticks

fig, ax = pplt.subplot()
ax.format(
    xticks=[0, 0.5, 1], #xticklabels=['a', 'b', 'c'],
    xminorticks=[0.1, 0.2],
)

image

But I got this if setting xticklabels

fig, ax = pplt.subplot()
ax.format(
    xticks=[0, 0.5, 1], xticklabels=['a', 'b', 'c'],
    xminorticks=[0.1, 0.2],
)

image

minorticks are gone...

Proplot version

Paste the results of import matplotlib; print(matplotlib.__version__); import proplot; print(proplot.version) here.
3.4.3
0.9.5.post341

Temporary workaround:
Set minor ticks manually after calling ax.format,

ax.set_xticks(tick_list, minor=True)

Thanks for the report. Setting minor ticks after major ticks seems to work too:

fig, ax = pplt.subplot()
ax.format(xticks=[0, 0.5, 1], xticklabels=['a', 'b', 'c'])
ax.format(xminorticks=[0.1, 0.2])

iTerm2 F1OMIJ tmp7n9dxpt3

This was due to a format() convenience feature: By default, if you pass major ticks labels, minor ticks are disabled, since it's pretty rare that users need both and since proplot changes the default matplotlib style to include minor ticks. This makes the process of setting up manual tick labels take 1 step instead of 2.

However, this should clearly be disabled if a minorlocator is passed in the same call. Fixed by a397f81.