繁体   English   中英

R零散堆积或填充的条形图显示未正确对齐的条形图

[英]R Plotly stacked or filled bar chart show not correctly aligned bars

我确实存在以下使用plotly填充或堆积的条形图所描述的问题。 当实际的ggplot图表完全对齐时,我遇到了以下问题。

library(plotly)

#> 
#> Attache Paket: 'plotly'
#> The following object is masked from 'package:ggplot2':
#> 
#>     last_plot
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following object is masked from 'package:graphics':
#> 
#>     layout
e <- ggplot(mpg, aes(cty, hwy, fill = cyl))
f <- e + geom_col(position = "fill")
f

ggplotly(f)

任何帮助将不胜感激。

尝试使用geom_bar(stat =“ identity”,position =“ fill”)代替geom_col。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM