Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize column Chart in R language

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "how to realize column chart in R language". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations. I hope you can read carefully and learn something!

Column Chart Ordinary Column Chart Cluster Column Chart Stack Column Chart df%

group_by(group)%>%

summarise(mean_value=mean(value),sd_value=sd(value)) -> df1

df1

library(ggplot2)

ggplot(data=df1,aes(x=group,y=mean_value))+

geom_col(aes(fill=group))+

geom_errorbar(aes(ymin=mean_value-sd_value,

ymax=mean_value+sd_value),

width=0.2)+

theme_bw()+

scale_y_continuous(expand=c(0,0),limits=c(0,4),

breaks = c(0,1,2,3,4))+

scale_fill_manual(values=c("#1f78b4", "#33a02c", "#e31a1c"))

image.pngdf%group_by(dose)%>%mutate(new_col=cumsum(len)) -> df1

df1

ggplot(data=df1,aes(x=dose,y=len,fill=supp))+

geom_bar(stat="identity",position="stack")+

geom_text(aes(label=len),

position = position_stack(vjust=0.5),color="white")+

geom_errorbar(aes(ymin=new_col-sd_value,ymax=new_col+sd_value),

width=0.1)+

theme_bw()+scale_fill_manual(values=c("#33a02c", "#e31a1c"))+

scale_y_continuous(expand = c(0,0),limits = c(0,70))

image.pngdf

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report