Lets star by importing our data.

#Call the data
abl<-read.csv("Abl.csv", sep = ",", header = TRUE)
glimpse(abl) #Its already in the long form for ggplot
## Rows: 24
## Columns: 4
## $ X         <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1…
## $ Grupes    <chr> "DCBLD2", "PDGFRB", "A_WT", "A_D842V", "DCBLD2", "PDGFRB", "…
## $ Treatment <chr> "DMSO", "DMSO", "DMSO", "DMSO", "DMSO", "DMSO", "DMSO", "DMS…
## $ Value     <dbl> 0.00000000, 0.86530183, 0.52830461, 0.55969396, 0.03473417, …
#Lets create a simple box plot, 
p1<-ggplot(abl, aes(x = Grupes, y = Value, fill = Treatment)) +
  geom_boxplot()

print(p1) 

This is not very pretty. I do not like the color, my name groups are awful. Do not like the background and other stuff. So lets change it.

Lets do a couple of things first: 1. Rearrange the order of the groups to have consistency across figures and other results.

  1. Change color, crating a variable name fill_colors, that way we could use the same across our paper.

  2. change the theme a use it consistently across the paper.

  3. Lastly add labels.

 #Define the desired fill color
fill_colors <- c("DMSO" = "thistle", "STI571" = "chocolate")

p1 <- ggplot(abl, aes(x = factor(Grupes, levels = c("DCBLD2", "PDGFRB", "A_WT", "A_D842V")), y = Value, fill = Treatment)) + geom_boxplot() + #Notice the groups order is define. 
  scale_fill_manual(values = fill_colors) + #Fill accordingly to groups 
  labs( x = "Groups", #Labels
       y = "pY Signal (Fold to base)",
       fill = "Treatment") +
  theme_light()
# Display the plot
print(p1)

This is starting to look way better. But there is a couple of extra things to do.

  1. Change the names to of goup variables. Notice we are using a short version to work in R, but this can be change.
# Change the group names
new_names <- c("Control", "PDGFRß", "PDGFRA WT", "PDGFRA D842V")

# Updated plot with new group names
p2 <- p1 + scale_x_discrete(labels = new_names)
print(p2)

The last this that is missing to be perfect is to the results of out post hoc test. We are going to perform an anova, comparing each group within treatment.

p2 <- ggplot(abl, aes(x = factor(Grupes, levels = c("DCBLD2", "PDGFRB", "A_WT", "A_D842V")), y = Value, fill = Treatment)) + 
  geom_boxplot() + 
  scale_fill_manual(values = fill_colors) + 
  labs(x = "Groups", y = "pY Signal (Fold to base)", fill = "Treatment") +
  theme_light() +
  stat_compare_means(aes(group = Treatment), method = "t.test", label = "p.signif") 

p3 <- p2 + scale_x_discrete(labels = new_names)
print(p3)

Now lets extract the figure to a new pdf, jpg or tiff.

#Save to PDF
ggsave("plot.pdf", p3, device = "pdf")
## Saving 7 x 5 in image
#Save o JPG
ggsave("plot.jpg", p3, device = "jpg")
## Saving 7 x 5 in image
#Lastly, save tiff 300 dpi as usually they ask. 

ggsave("plot.tiff", p3, device = "tiff", dpi = 300)
## Saving 7 x 5 in image