Question: Change Y axis font size wit Scanpy
0
gravatar for Thorerges
4 weeks ago by
Thorerges10
Thorerges10 wrote:

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?

scanpy rna-seq python • 108 views
ADD COMMENTlink modified 4 weeks ago by zorbax210 • written 4 weeks ago by Thorerges10

The same has been answered in this SO thread: https://stackoverflow.com/questions/63925267/how-to-change-font-size-in-scanpy

ADD REPLYlink written 4 weeks ago by Arup Ghosh2.7k
0
gravatar for zorbax
4 weeks ago by
zorbax210
Mexico
zorbax210 wrote:

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 COMMENTlink modified 4 weeks ago • written 4 weeks ago by zorbax210
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2070 users visited in the last hour