Making elements in gooplot2 bigger

Hello

I have such a data

> dput(x)
structure(list(gene = c("14q", "20q", "18q", "4q", "21p", "21q", 
"5q", "22q", "17p", "3p", "9p", "4p", "9q", "19q", "10q", "15q", 
"16p", "19p", "1p", "18p", "16q", "8p"), CNV = c("Deletion", 
"Amplification", "Deletion", "Deletion", "Deletion", "Deletion", 
"Deletion", "Deletion", "Deletion", "Deletion", "Deletion", "Deletion", 
"Deletion", "Deletion", "Deletion", "Deletion", "Deletion", "Deletion", 
"Deletion", "Deletion", "Deletion", "Deletion"), log10_pvalue = c(1.197226275, 
1.88941029, 5.974694135, 5.73754891, 4.995678626, 4.970616222, 
4.793174124, 4.793174124, 4.109020403, 3.524328812, 3.524328812, 
2.823908741, 2.567030709, 2.186419011, 1.769551079, 1.59345982, 
1.59345982, 1.59345982, 1.416801226, 1.195860568, 1.094743951, 
1.087777943), Percentage_altered = c(3000, 5000, 6100, 5300, 
6100, 5600, 4400, 5000, 5000, 4400, 5000, 4700, 3900, 2800, 3300, 
3100, 3300, 3100, 2200, 3600, 3300, 3300), group = c("Responders", 
"Responders", "Non-responders", "Non-responders", "Non-responders", 
"Non-responders", "Non-responders", "Non-responders", "Non-responders", 
"Non-responders", "Non-responders", "Non-responders", "Non-responders", 
"Non-responders", "Non-responders", "Non-responders", "Non-responders", 
"Non-responders", "Non-responders", "Non-responders", "Non-responders", 
"Non-responders")), row.names = c(NA, -22L), class = "data.frame")

I have used this code 

> p=x %>% 
Warning messages:
1: ggrepel: 6 unlabeled data points (too many overlaps). Consider increasing max.overlaps 
2: ggrepel: 6 unlabeled data points (too many overlaps). Consider increasing max.overlaps 
+     mutate(net_frequency=ifelse(CNV == "Deletion", -Percentage_altered/100, Percentage_altered/100),
+            log10_pvalue = if_else(CNV == "Deletion", log10_pvalue, log10_pvalue)) %>% 
+     ggplot(aes(x = log10_pvalue, y = net_frequency, color = log10_pvalue)) +
+     geom_point(aes(size=Percentage_altered)) +
+     geom_text_repel(aes(label=gene), force=15) +
+     geom_hline(yintercept=0, lty=2) +
+     scale_color_distiller(type = "div",palette = 5) +
+     theme_classic() +
+     facet_wrap(~group)
> p+xlab("-log10(qvalue)")+ylab("Net frequency of gain and deletion (%)")+theme(
+     plot.title = element_text(color="black", size=14, face="bold.italic"),
+     axis.title.x = element_text(color="black", size=14, face="bold"),
+     axis.title.y = element_text(color="black", size=14, face="bold")
+ )+theme(axis.text.x = element_text(face="bold", color="black", 
+                                    size=14),
+         axis.text.y = element_text(face="bold", color="black", 
+                                    size=14))

To plot something like this

You are seeing here, chromosomal arm size like 1p, 14q, whetever are too small too read even color causes some arms are not readable. How I can make the size of these elements bigger please ?

Thank you so much in advance

Hi @mina_ming and welcome to the RStudio Community :partying_face: :partying_face: :partying_face: :partying_face: :partying_face: :partying_face:

Would you please let us know which column of your dataset corresponds to the y-axis of your plot (i.e. Net frequency gain and deletion)?

Thank you so much @gueyenono Percentage_altered column in my data corresponds to the Y axis

Did you apply any sort of transformation to the data? I am asking because the Percentage_altered column has values, which are in the thousands, while your y-axis has values between -100 and 100.

Sorry @gueyenono this is maybe my fault because the data in Y axis should be in the range of 100 percentge (negative values for the percentage does not make sense). I guess negative comes from I have both deletion and ampification in CNV column which are two different genomic event. May be negative values tries to separare deletion (lower part of Y axis) from amplification (upper part of Y axis) but again being negative does not make sense and I try to have these two parts separated with a 0 border line using only +100

So then, if the y-axis is Percentage_altered and is supposed to be between 0 and 100%, how did you transform the data? Because as I said, the values are in the thousands. Did you divide the data by a certain value?

I guess I may multiplied by 100

Hey @mina_ming,

I am glad I was able to help. After our Zoom discussion, here is the code that we came up with:

x <- structure(list(gene = c("14q", "20q", "18q", "4q", "21p", "21q", 
                             "5q", "22q", "17p", "3p", "9p", "4p", "9q", "19q", "10q", "15q", 
                             "16p", "19p", "1p", "18p", "16q", "8p"), CNV = c("Deletion", 
                                                                              "Amplification", "Deletion", "Deletion", "Deletion", "Deletion", 
                                                                              "Deletion", "Deletion", "Deletion", "Deletion", "Deletion", "Deletion", 
                                                                              "Deletion", "Deletion", "Deletion", "Deletion", "Deletion", "Deletion", 
                                                                              "Deletion", "Deletion", "Deletion", "Deletion"), log10_pvalue = c(1.197226275, 
                                                                                                                                                1.88941029, 5.974694135, 5.73754891, 4.995678626, 4.970616222, 
                                                                                                                                                4.793174124, 4.793174124, 4.109020403, 3.524328812, 3.524328812, 
                                                                                                                                                2.823908741, 2.567030709, 2.186419011, 1.769551079, 1.59345982, 
                                                                                                                                                1.59345982, 1.59345982, 1.416801226, 1.195860568, 1.094743951, 
                                                                                                                                                1.087777943), Percentage_altered = c(3000, 5000, 6100, 5300, 
                                                                                                                                                                                     6100, 5600, 4400, 5000, 5000, 4400, 5000, 4700, 3900, 2800, 3300, 
                                                                                                                                                                                     3100, 3300, 3100, 2200, 3600, 3300, 3300), group = c("Responders", 
                                                                                                                                                                                                                                          "Responders", "Non-responders", "Non-responders", "Non-responders", 
                                                                                                                                                                                                                                          "Non-responders", "Non-responders", "Non-responders", "Non-responders", 
                                                                                                                                                                                                                                          "Non-responders", "Non-responders", "Non-responders", "Non-responders", 
                                                                                                                                                                                                                                          "Non-responders", "Non-responders", "Non-responders", "Non-responders", 
                                                                                                                                                                                                                                          "Non-responders", "Non-responders", "Non-responders", "Non-responders", 
                                                                                                                                                                                                                                          "Non-responders")), row.names = c(NA, -22L), class = "data.frame")
pacman::p_load(dplyr, ggplot2, ggrepel)

x <- x %>%
  rename(log10_qvalue = log10_pvalue)

ggplot(data = x, aes(x = log10_qvalue, y = Percentage_altered/100, color = CNV)) +
  geom_point( ) +
  scale_discrete_manual(aesthetics = "colour", values = c("Deletion" = "blue", "Amplification" = "red")) +
  geom_text_repel(aes(label = gene), size = 5) +
  facet_grid(CNV ~ group) +
  labs(x = "-log10(qvalue)", y = "Net frequency of gain and deletion (%)") +
  theme_bw() +
  theme(
    legend.position = "none",
    axis.title = element_text(size = 12, face = "bold"),
    axis.text = element_text(size = 12, face = "bold"),
    strip.text = element_text(size = 12, face = "bold")
  )
``` `

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.