Reputation: 89
I have a dataframe that I need to barplot. The problem is that it's too large for the plot to be displayed correctly and I'm unable to analyse any of the bars. The graph is not zoomable either.
The code I'm using is the following one:
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))
For reasonably small amounts of data the plot looks perfect. Just like this:
But then it's a mess for bigger data amounts.
How can I make a nice looking barplot or at least a legible one for large amounts of data?
Thanks.
Upvotes: 1
Views: 3111
Reputation: 1820
Try this:
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
Upvotes: 1