From 3f95e56f503ab5feb63ea75aaa3fe4a79f9e99f5 Mon Sep 17 00:00:00 2001 From: ShouWenWang Date: Thu, 8 Dec 2022 12:14:12 -0500 Subject: [PATCH] convert gene labels to italic --- cospar/plotting/_gene.py | 3 +++ cospar/plotting/_utils.py | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cospar/plotting/_gene.py b/cospar/plotting/_gene.py index bed6c65..564e080 100644 --- a/cospar/plotting/_gene.py +++ b/cospar/plotting/_gene.py @@ -409,6 +409,7 @@ def gene_expression_heatmap( vmax=vmax, color_bar_label=color_bar_label, order_map_x=order_map_x, + x_tick_style='italic', order_map_y=order_map_y, **kwargs, ) @@ -426,6 +427,7 @@ def gene_expression_heatmap( vmax=vmax, color_bar_label=color_bar_label, order_map_x=order_map_x, + y_tick_style='italic', order_map_y=order_map_y, **kwargs, ) @@ -504,6 +506,7 @@ def gene_expression_on_manifold( point_size=point_size, color_bar_label="Normalized expression", ) + plt.title(g,style='italic') plt.tight_layout() if savefig: diff --git a/cospar/plotting/_utils.py b/cospar/plotting/_utils.py index 8c68f84..a48deac 100644 --- a/cospar/plotting/_utils.py +++ b/cospar/plotting/_utils.py @@ -289,6 +289,8 @@ def heatmap( order_map_y=True, x_ticks=None, y_ticks=None, + x_tick_style=None, + y_tick_style=None, col_range=[0, 99], color_bar_label="", log_transform=False, @@ -300,6 +302,8 @@ def heatmap( color_bar=True, x_label=None, y_label=None, + x_label_style=None, + y_label_style=None, print_ordered_labels=False, pseudo_count=10 ** (-10), ax=None, @@ -411,6 +415,7 @@ def heatmap( x_array, np.array(x_ticks)[order_x], rotation=90, + style=x_tick_style, ) if print_ordered_labels: @@ -424,6 +429,7 @@ def heatmap( plt.yticks( y_array, np.array(y_ticks)[order_y], + style=y_tick_style, ) if print_ordered_labels: @@ -432,10 +438,10 @@ def heatmap( print(f"y_ticks: ['{y_ticks_print}']") if x_label is not None: - ax.set_xlabel(x_label) + ax.set_xlabel(x_label,style=x_label_style) if y_label is not None: - ax.set_ylabel(y_label) + ax.set_ylabel(y_label,style=y_label_style) if color_bar: norm = mpl_Normalize(vmin=vmin, vmax=vmax)