【问题标题】:How to barplot large amounts of data in R如何在R中绘制大量数据
【发布时间】:2020-04-17 18:16:09
【问题描述】:

我有一个需要绘制条形图的数据框。问题是绘图太大而无法正确显示,我无法分析任何条形图。图表也不能缩放。

我使用的代码如下:

ggplot(grafE,aes(x=Estados,y=Freq)) + 
geom_bar(stat="identity",fill="Red") +
coord_flip() +
ylab("Numero de casos") + xlab("Estados") + 
geom_text(aes(x = Estados,   y = Freq+30, label = Freq))

对于相当少量的数据,该图看起来很完美。就像这样:

但是对于更大的数据量来说,这是一团糟。

我怎样才能为大量数据制作一个漂亮的条形图或至少一个清晰的条形图?

谢谢。

【问题讨论】:

  • 你试过ggplotly吗?您可以放大那里的数据....

标签: r ggplot2 bar-chart data-visualization


【解决方案1】:

试试这个:

ggp <- ggplot(grafE,aes(x=Estados,y=Freq)) + 
geom_bar(stat="identity",fill="Red") +
coord_flip() +
ylab("Numero de casos") + xlab("Estados") + 
geom_text(aes(x = Estados,   y = Freq+30, label = Freq))

library{plotly}; #required package.
ggp %>% ggplotly; # then check in the viewer

【讨论】:

    猜你喜欢
    • 2010-09-20
    • 2021-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多