Skip to content

Commit

Permalink
convert gene labels to italic
Browse files Browse the repository at this point in the history
  • Loading branch information
ShouWenWang committed Dec 8, 2022
1 parent fc81747 commit 3f95e56
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions cospar/plotting/_gene.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -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,
)
Expand Down Expand Up @@ -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:
Expand Down
10 changes: 8 additions & 2 deletions cospar/plotting/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -411,6 +415,7 @@ def heatmap(
x_array,
np.array(x_ticks)[order_x],
rotation=90,
style=x_tick_style,
)

if print_ordered_labels:
Expand All @@ -424,6 +429,7 @@ def heatmap(
plt.yticks(
y_array,
np.array(y_ticks)[order_y],
style=y_tick_style,
)

if print_ordered_labels:
Expand All @@ -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)
Expand Down

0 comments on commit 3f95e56

Please sign in to comment.