enblacar / SCpubr

Generate high quality, publication ready visualizations for single cell transcriptomics data.
https://enblacar.github.io/SCpubr-book/
GNU General Public License v3.0
150 stars 12 forks source link

Show Genenames in featureplot for feature vector #66

Closed TdzBAS closed 3 months ago

TdzBAS commented 3 months ago

Hi @mojaveazure,

thanks for your awesome tool!

I cant see how I can show the featurenames, if I plot a featurevector: image

Do you have an idea?

Best, Tolga

enblacar commented 3 months ago

Hi @TdzBAS,

Thanks for using my package!

Would it be possible if you could include the code that you used to generate this plot? That will allow me to have a better understanding of the issue.

Many thanks! Enrique

TdzBAS commented 3 months ago

Hi @enblacar,

thanks for your quick reply!

this is the code: image

So i want to see the featurenames above the featureplots.

Many Thanks! Tolga

enblacar commented 3 months ago

Hi @TdzBAS,

I see! Can you please retry with legend.position = "bottom" and let me know if that works?

If what you want to do is just show the feature names, this is normally encoded in the legend in SCpubr::do_FeaturePlot(). With the current release, you will have to add then manually afterwards if you want to still remove the legend:

p <- your_plot
# For each panel, add the title manually.
p[[1]] <- p[[1]] + ggplot2::ggtitle("your_title")
p[[2]] <- p[[2]] + ggplot2::ggtitle("your_other_title")

Hope this helps!

Best, Enrique

TdzBAS commented 3 months ago

thanks this worked!

The title is now leftadjusted, can i center it?

image

enblacar commented 3 months ago

You can do it with:

p <- p + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5))

Glad it helped! Enrique