Skip to content

Commit 2c1b2a9

Browse files
committed
Fix axis_ticks_length for the x-axis
1 parent 0ba0109 commit 2c1b2a9

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

doc/changelog.qmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ title: Changelog
2323

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

26+
- Fixed bug for matplotlib>3.10 where the `axis_ticks_length` for the x-axis
27+
had no effect.
28+
2629
## v0.14.3
2730
(2024-11-26)
2831
[![](https://zenodo.org/badge/DOI/10.5281/zenodo.14224336.svg)](https://doi.org/10.5281/zenodo.14224336)

plotnine/themes/themeable.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,9 +1037,21 @@ class axis_ticks_major_x(MixinSequenceOfValues):
10371037
def apply_ax(self, ax: Axes):
10381038
super().apply_ax(ax)
10391039
params = ax.xaxis.get_tick_params(which="major")
1040-
if not params.get("left", False):
1040+
1041+
# TODO: Remove this code when the minimum matplotlib >= 3.10.0,
1042+
# and use the commented one below it
1043+
import matplotlib as mpl
1044+
from packaging import version
1045+
1046+
vinstalled = version.parse(mpl.__version__)
1047+
v310 = version.parse("3.10.0")
1048+
name = "bottom" if vinstalled >= v310 else "left"
1049+
if not params.get(name, False):
10411050
return
10421051

1052+
# if not params.get("bottom", False):
1053+
# return
1054+
10431055
tick_params = {}
10441056
properties = self.properties
10451057
with suppress(KeyError):

0 commit comments

Comments
 (0)