filmov
tv
Advanced ggplot2: Barplot with highlights : Plot the plots as we see in research Journals
![preview_player](https://i.ytimg.com/vi/ryKsTg5dhRY/maxresdefault.jpg)
Показать описание
#rprogramming #barcharts #barplot #ggplot2
This tutorial series will help you to make plots which are at par with what we see in research journals.
In this video I have discussed:
1. How to get highlighted bars in barplot
2. customise the plot using theme elements
3. use scale_continuous to customise tick labels and plot origin
4. Add greek letters and superscripts in axis labels
5. Get text on the plot using annotate layers
6. Customise text elements using theme elements.
The original plot is from
I guessed the data from the plot and recreated it in this tutorial.
Facebook page:
Mail Id:
youtube playlist:
# data
# download the file and save it in your working directory and set that directory as a working directory by changing the path in setwd() .
# code
setwd("G:\\Rworks\\Barplots_highlights")
head(df)
tail(df)
summary(df)
library(dplyr)
x_breaks= 1:40
tick_labels[c(2:9,11:19,21:29,31:37,39:40)]=""
library(ggplot2)
geom_col(width=0.7,fill="black")+
scale_y_continuous(expand=c(0,0))+
theme_bw()+
text=element_text(size=26, color="black"),
expand_limits(y=c(0,2))+
scale_x_continuous(breaks=x_breaks, labels =tick_labels )+
ylab(expression(paste(Delta,delta,""^1,"H",""^15,"N (PPM)")))+
xlab("Residue number")+
annotate(geom="text",x=13, y=1.8, label="Δ(NCR169-ox1,NCR169-ox2)",size=9)
This tutorial series will help you to make plots which are at par with what we see in research journals.
In this video I have discussed:
1. How to get highlighted bars in barplot
2. customise the plot using theme elements
3. use scale_continuous to customise tick labels and plot origin
4. Add greek letters and superscripts in axis labels
5. Get text on the plot using annotate layers
6. Customise text elements using theme elements.
The original plot is from
I guessed the data from the plot and recreated it in this tutorial.
Facebook page:
Mail Id:
youtube playlist:
# data
# download the file and save it in your working directory and set that directory as a working directory by changing the path in setwd() .
# code
setwd("G:\\Rworks\\Barplots_highlights")
head(df)
tail(df)
summary(df)
library(dplyr)
x_breaks= 1:40
tick_labels[c(2:9,11:19,21:29,31:37,39:40)]=""
library(ggplot2)
geom_col(width=0.7,fill="black")+
scale_y_continuous(expand=c(0,0))+
theme_bw()+
text=element_text(size=26, color="black"),
expand_limits(y=c(0,2))+
scale_x_continuous(breaks=x_breaks, labels =tick_labels )+
ylab(expression(paste(Delta,delta,""^1,"H",""^15,"N (PPM)")))+
xlab("Residue number")+
annotate(geom="text",x=13, y=1.8, label="Δ(NCR169-ox1,NCR169-ox2)",size=9)
Комментарии