Skip to content

Commit 252196f

Browse files
committed
fix the bug of ha for xticklabels_kws
1 parent 1934419 commit 252196f

File tree

2 files changed

+27
-140
lines changed

2 files changed

+27
-140
lines changed

PyComplexHeatmap/clustermap.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2175,10 +2175,10 @@ def set_axes_labels_kws(self):
21752175
and (
21762176
(not self.bottom_annotation is None)
21772177
or (self.bottom_annotation is None and self.col_names_side == "top")
2178-
)
2179-
):
2178+
)
2179+
): # tick top
21802180
self.xticklabels_kws.setdefault("labelrotation", 90)
2181-
ha = 'left' if self.xticklabels_kws.get('labelrotation') > 0 else 'right'
2181+
ha = 'left' if self.xticklabels_kws.get('labelrotation') > 0 else 'right' if self.xticklabels_kws.get('labelrotation') < 0 else 'center'
21822182
for j in range(self.heatmap_axes.shape[1]):
21832183
self.heatmap_axes[0, j].xaxis.tick_top() # ticks
21842184
self.heatmap_axes[0, j].xaxis.set_visible(True)
@@ -2195,7 +2195,7 @@ def set_axes_labels_kws(self):
21952195
self.xticklabels.extend(self.heatmap_axes[0, j].get_xticklabels())
21962196
elif self.show_colnames and self.bottom_annotation is None: # tick bottom
21972197
self.xticklabels_kws.setdefault("labelrotation", -90)
2198-
ha='left' if self.xticklabels_kws.get('labelrotation') < 0 else 'right'
2198+
ha='left' if self.xticklabels_kws.get('labelrotation') < 0 else 'right' if self.xticklabels_kws.get('labelrotation') > 0 else 'center'
21992199
for j in range(self.heatmap_axes.shape[1]):
22002200
self.heatmap_axes[-1, j].xaxis.tick_bottom() # ticks
22012201
self.heatmap_axes[-1, j].xaxis.set_visible(True)

0 commit comments

Comments
 (0)