Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The angle parameter doesn't work in the theme function #235

Open
Sophia409 opened this issue Apr 15, 2024 · 1 comment
Open

The angle parameter doesn't work in the theme function #235

Sophia409 opened this issue Apr 15, 2024 · 1 comment

Comments

@Sophia409
Copy link

Hello, SCP team,

I have an unresolved question and would appreciate your guidance.

Why does setting the angle parameter not work in the theme function? This question has puzzled me for a long time

FeatureStatPlot(myobject, stat.by = c("nFeature_RNA"), group.by = "celltype", palette = "Blues",stack = T,legend.position = 'none',theme_args = theme(axis.text.x = element_text(color="#993333",angle=90)))
image

Thank you very much for your response.

Sophia

@MInsYang
Copy link

MInsYang commented Apr 19, 2024

Hello, I am not part of the SCP team, but I have reviewed the SCP code. The cause of this issue may lie in the internal function ExpressionStatPlot being called by FeatureStatPlot.
In terms of the usage of theme_args, the code includes: p <- p + do.call(theme_use, theme_args) + theme(aspect.ratio = aspect.ratio, axis.text.x = element_text(angle = 45, hjust = 1, vjust = 1)..., which means that when you set the angle of axis.text.x through theme_args in FeatureStatPlot, it will be overridden by the default settings of the function. Therefore, to achieve your desired effect, you can use FeatureStatPlot(myobject, stat.by = c("nFeature_RNA"), group.by = "celltype", palette = "Blues", stack = T, legend.position = 'none', theme_args = theme(axis.text.x = element_text(color="#993333"))) + theme(axis.text.x = element_text(angle = 90)) or directly set the theme after obtaining the ggplot object from FeatureStatPlot like FeatureStatPlot(myobject, stat.by = c("nFeature_RNA"), group.by = "celltype", palette = "Blues",stack = T,legend.position = 'none')+ theme(axis.text.x = element_text(color="#993333",angle=90))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants