Change Y axis font size wit Scanpy
1
0
Entering edit mode
3.6 years ago
Thorerges ▴ 10

I would like to increase the font size of only the y axis ticks:

sc.pl.dotplot(data, ["gene"], 'CellType',figsize=(4,10), dendrogram=False)

Using plt.rcParams.update({'ytick.labelsize': 50}) doesn’t work. Updating rcParams using:

matplotlib.rcParams.update({'font.size': 5})

changes fonts for the entire plot, but I am interested in just the Y axis.

Does anyone know how to do this?

RNA-Seq scanpy python • 2.3k views
ADD COMMENT
0
Entering edit mode
ADD REPLY
0
Entering edit mode
3.6 years ago
zorbax ▴ 610

You can modify the ylabel and yticks size with matplotlib.pyplot for a specific plot, without the global options of matplotlib.

import matplotlib.pyplot as plt
plt.xlabel('This is my x text label', size = 30)
plt.ylabel('This is my y text label', size = 20)
plt.xticks(size = 20)
plt.yticks(size = 20)

I used this example from the Matplotlin documentation: https://matplotlib.org/3.3.1/gallery/shapes_and_collections/scatter.html

import numpy as np
import matplotlib.pyplot as plt

np.random.seed(1986)

N = 50
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
area = (30 * np.random.rand(N))**2

plt.scatter(x, y, s=area, c=colors, alpha=0.5);

plt.xlabel('This is my X text label', size = 30);
plt.ylabel('This is my Y text label', size = 20);
plt.xticks(size = 20);
plt.yticks(size = 20);

# plt.show()      # This is not necessary for Jupyter.
ADD COMMENT

Login before adding your answer.

Traffic: 2614 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6