Skip to content

Commit 856118b

Browse files
committed
small fix
1 parent 62080bc commit 856118b

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

matplotlib2tikz/axes.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -413,20 +413,17 @@ def _subplot(self, obj, data):
413413
return
414414

415415

416-
def _get_label_rotation_and_horizontal_alignment(obj, data, axes_obj):
416+
def _get_label_rotation_and_horizontal_alignment(obj, data, x_or_y):
417417
tick_label_text_width = None
418-
tick_label_text_width_identifier = "{} tick label text width".format(axes_obj)
418+
tick_label_text_width_identifier = "{} tick label text width".format(x_or_y)
419419
if tick_label_text_width_identifier in data["extra axis options"]:
420-
tick_label_text_width = data["extra axis options [base]"][
421-
tick_label_text_width_identifier
422-
]
423-
del data["extra axis options"][tick_label_text_width_identifier]
420+
data["extra axis options"].remove(tick_label_text_width_identifier)
424421

425422
label_style = ""
426423

427424
major_tick_labels = (
428425
obj.xaxis.get_majorticklabels()
429-
if axes_obj == "x"
426+
if x_or_y == "x"
430427
else obj.yaxis.get_majorticklabels()
431428
)
432429

@@ -457,7 +454,7 @@ def _get_label_rotation_and_horizontal_alignment(obj, data, axes_obj):
457454

458455
if values:
459456
label_style = "{}ticklabel style = {{{}}}".format(
460-
axes_obj, ",".join(values)
457+
x_or_y, ",".join(values)
461458
)
462459
else:
463460
values = []
@@ -478,12 +475,12 @@ def _get_label_rotation_and_horizontal_alignment(obj, data, axes_obj):
478475
else:
479476
for idx, x in enumerate(tick_labels_horizontal_alignment):
480477
label_style += "{}_tick_label_ha_{}/.initial = {}".format(
481-
axes_obj, idx, x
478+
x_or_y, idx, x
482479
)
483480

484481
values.append(
485482
"align=\\pgfkeysvalueof{{/pgfplots/{}_tick_label_ha_\\ticknum}}".format(
486-
axes_obj
483+
x_or_y
487484
)
488485
)
489486
values.append("text width={}".format(tick_label_text_width))
@@ -493,13 +490,13 @@ def _get_label_rotation_and_horizontal_alignment(obj, data, axes_obj):
493490
"Horizontal alignment will be ignored as no '{} tick "
494491
"label text width' has been passed in the 'extra' "
495492
"parameter"
496-
).format(axes_obj)
493+
).format(x_or_y)
497494
)
498495

499496
label_style = (
500497
"every {} tick label/.style = {{\n"
501498
"{}\n"
502-
"}}".format(axes_obj, ",\n".join(values))
499+
"}}".format(x_or_y, ",\n".join(values))
503500
)
504501

505502
return label_style

0 commit comments

Comments
 (0)