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

Radar plot usage in R - Visualize Correlation between Gene and Tumor Stemness #239

Closed
quiquemedina opened this issue Feb 21, 2022 · 2 comments

Comments

@quiquemedina
Copy link

Hi there!

In RStudio help and the Package ‘UCSCXenaShiny’ manual (page 31), the command below does not plot a radar plot but a histogram. However, in the app it does

Usage is:
vis_gene_stemness_cor(
Gene = "TP53",
cor_method = "spearman",
data_type = "mRNA",
Plot = "TRUE"
)

I installed ggradar to create radar charts using ggplot2 but fell to reproduce a plot.
I want to ask you for a syntax example for the usage of UCSCXenaShiny stemness in R with a radar plot as output.

@Byronxy
Copy link
Contributor

Byronxy commented Feb 21, 2022

Hi quiquemedina,
Currently we don't package the radar plot as a function. Here I provide the code about how to plot a radar plot. This is the same way as the shiny app does. Hope this could help you!
Below is the code:

library(UCSCXenaShiny)
library(ggradar)

p = vis_gene_stemness_cor(
  Gene = "TP53",
  cor_method = "spearman",
  data_type = "mRNA",
  Plot = "TRUE"
)

pdata <- p$data %>%
  dplyr::mutate(cor = round(cor, digits = 3), p.value = round(p.value, digits = 3))

df <- pdata %>%
  select(cor, cancer) %>%
  pivot_wider(names_from = cancer, values_from = cor)


ggradar::ggradar(
  df[1, ],
  font.radar = "sans",
  values.radar = c("-1", "0", "1"),
  grid.min = -1, grid.mid = 0, grid.max = 1,
  # Background and grid lines
  background.circle.colour = "white",
  gridline.mid.colour = "grey",
  # Polygons
  group.line.width = 1,
  group.point.size = 3,
  group.colours = "#00AFBB",
) + theme(plot.title = element_text(hjust = .5))

@quiquemedina
Copy link
Author

Thank you so much for your (as always) expedited resolution and help.
Enrique.

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