ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

How to plot barplots similar to those in journal articles using R and ggplot2 and other packages

Автор: Rajendra Choure

Загружено: 2022-10-03

Просмотров: 3484

Описание: #datavisualization #rprogramming #barcharts #ggplot2 #barplot
#research
This is a complete tutorial to plot publication-ready bar plots.
In this video, I have demonstrated how to plot a barplot similar to those we see in research articles in scientific journals. Here I have plotted the barplot using ggplot2 functions. The bar plots are in grayscale and mapped to a categorical variable. I have discussed how to rearrange the bars as per our requirement. Error bars also are plotted and customized. Some journals require error bars only at top of bars, I have discussed using ggAnnotate package function geom_halferrorbar().

The originalplots are form :
Mikuláss KR, Nagy K, Bogos B, Szegletes Z, Kovács E, Farkas A, Váró G, Kondorosi É, Kereszt A. Antimicrobial nodule-specific cysteine-rich peptides disturb the integrity of bacterial outer and inner membranes and cause loss of membrane potential. Ann Clin Microbiol Antimicrob. 2016 Jul 28;15(1):43. doi: 10.1186/s12941-016-0159-8. PMID: 27465344; PMCID: PMC4964015.

Data used is not original. I just made up the data to make similar plots.
Loink to dwonload data: https://docs.google.com/spreadsheets/...

#the code

setwd("D:\\RGC work\\Rworks\\bargraphasyouseeinpublications")

to read xlsx file
library(readxl)

for half error bars
install.packages("remotes")
remotes::install_github("azzoam/ggAnnotate")
library(ggAnnotate)


df1 = read_xlsx("data.xlsx",range="A1:C6")

df1$Ab = factor(df1$Ab,levels=c("Chloroform+SDS" ,"Polymyxin B" , "NCR335", "NCR247" , "NCR001"))
library(ggplot2)

p1 = ggplot(df1,aes(Ab,MillerUnit,fill=Ab,label=MillerUnit))+
geom_col()+
geom_halferrorbar(aes(ymax=MillerUnit+SD),width=0.2,size=1,color="black")+
scale_fill_grey()+
geom_text(vjust=-1.5)+
theme_classic()+
scale_y_continuous(expand=c(0,0))+
expand_limits(y=c(0,150))+
theme(legend.position = "none",axis.text.x = element_text(angle=90,vjust=0.2,hjust=0.9),text=element_text(size=14,face="bold",colour = "black"))+
labs(x="",y="Miller Units %")


df2 = read_xlsx("data.xlsx",range="A8:C14")

df2$Ab = factor(df2$Ab,levels=c("Control", "CCCP" , "Polymyxin B", "NCR335" , "NCR247" , "NCR001" ))
library(ggplot2)

p2 = ggplot(df2,aes(Ab,`Relative Fluorescence` ,fill=Ab ))+
geom_col()+
geom_halferrorbar(aes(ymax=`Relative Fluorescence` +SD),width=0.2,size=1,color="black")+
scale_fill_grey()+
theme_classic()+
scale_y_continuous(expand=c(0,0))+
expand_limits(y=c(0,0.8))+
theme(legend.position = "none",axis.text.x = element_text(angle=90,vjust=0.2,hjust=0.9),text=element_text(size=14,face="bold",colour = "black"))+
labs(x="",y="Relative Fluorescence(red/green) %")+
geom_hline(yintercept=0.25,linetype=3,size=2,color="grey40")



for arranging multiiple graphs together
library(patchwork)
p = p1/p2
p+plot_annotation(tag_levels = "a")


Facebook page:
  / rajendrachoureisc  

Mail Id:
[email protected]

youtube playlist:
   • R programming tutorials  

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
How to plot barplots similar to those in journal articles using R  and ggplot2 and other packages

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

How to add citations  in R markdown?

How to add citations in R markdown?

Столбчатые диаграммы с {ggplot2}

Столбчатые диаграммы с {ggplot2}

R

R

Barplot with error bar using stat summary function, A shortcut

Barplot with error bar using stat summary function, A shortcut

How to read a box plot (a.k.a. a box-and-whisker plot) - Nick Desbarats

How to read a box plot (a.k.a. a box-and-whisker plot) - Nick Desbarats

Data Visualisation

Data Visualisation

Почему Кошки Вдруг ЗАЛЕЗАЮТ На Вас? (Причина шокирует)

Почему Кошки Вдруг ЗАЛЕЗАЮТ На Вас? (Причина шокирует)

Проект R — как создать столбчатую диаграмму (ggplot2) из ​​электронной таблицы — включает в себя ...

Проект R — как создать столбчатую диаграмму (ggplot2) из ​​электронной таблицы — включает в себя ...

Make an apa-style bar graph in ggplot2

Make an apa-style bar graph in ggplot2

Adding lines and asterisks of statistical significance on a figure with ggplot2 (CC093)

Adding lines and asterisks of statistical significance on a figure with ggplot2 (CC093)

Беззубчатые шестерни развивают гораздо больший крутящий момент, чем обычные, вот почему. Циклоида...

Беззубчатые шестерни развивают гораздо больший крутящий момент, чем обычные, вот почему. Циклоида...

Взломать за один промпт. Как OpenClaw открывает простор для киберпреступников

Взломать за один промпт. Как OpenClaw открывает простор для киберпреступников

Bar charts and Histograms using ggplot in R

Bar charts and Histograms using ggplot in R

Архитектура JEPA Яна Лекуна. Модели на основе энергии (Energy-Based Models)

Архитектура JEPA Яна Лекуна. Модели на основе энергии (Energy-Based Models)

Честно про аддитивные технологии.

Честно про аддитивные технологии.

Как создать и улучшить столбчатую диаграмму с помощью меток данных, полосы погрешностей и легенды...

Как создать и улучшить столбчатую диаграмму с помощью меток данных, полосы погрешностей и легенды...

Визуализируйте данные с помощью ggplot. Программирование на R — лучшая платформа для создания гра...

Визуализируйте данные с помощью ggplot. Программирование на R — лучшая платформа для создания гра...

Performing principal coordinate analysis (PCoA) in R and visualizing with ggplot2 (CC186)

Performing principal coordinate analysis (PCoA) in R and visualizing with ggplot2 (CC186)

ЧТО СКРЫВАЕТ ДНО БАЙКАЛА? КУСТО НАШЕЛ ЭТО И УМЕР ЧЕРЕЗ 3 ДНЯ...

ЧТО СКРЫВАЕТ ДНО БАЙКАЛА? КУСТО НАШЕЛ ЭТО И УМЕР ЧЕРЕЗ 3 ДНЯ...

R Tutorial 14. plot|Plot Bar plot in R Categorical variable with customized color |Percentage plot R

R Tutorial 14. plot|Plot Bar plot in R Categorical variable with customized color |Percentage plot R

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]