Skip to content

Commit

Permalink
Fix axis_ticks_length for the x-axis
Browse files Browse the repository at this point in the history
  • Loading branch information
has2k1 committed Dec 16, 2024
1 parent 0ba0109 commit 2c1b2a9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions doc/changelog.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ title: Changelog

if the `y` aesthetic is mapped to datetime column in another layer.

- Fixed bug for matplotlib>3.10 where the `axis_ticks_length` for the x-axis
had no effect.

## v0.14.3
(2024-11-26)
[![](https://zenodo.org/badge/DOI/10.5281/zenodo.14224336.svg)](https://doi.org/10.5281/zenodo.14224336)
Expand Down
14 changes: 13 additions & 1 deletion plotnine/themes/themeable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,9 +1037,21 @@ class axis_ticks_major_x(MixinSequenceOfValues):
def apply_ax(self, ax: Axes):
super().apply_ax(ax)
params = ax.xaxis.get_tick_params(which="major")
if not params.get("left", False):

# TODO: Remove this code when the minimum matplotlib >= 3.10.0,
# and use the commented one below it
import matplotlib as mpl
from packaging import version

vinstalled = version.parse(mpl.__version__)
v310 = version.parse("3.10.0")
name = "bottom" if vinstalled >= v310 else "left"
if not params.get(name, False):
return

# if not params.get("bottom", False):
# return

tick_params = {}
properties = self.properties
with suppress(KeyError):
Expand Down

0 comments on commit 2c1b2a9

Please sign in to comment.