plot - R barplot with y-axis greater than zero -
i want plot data in r.
the table like:
name count 110 b 120 c 130
i want plot table each column name
, bar height count
. want zoom important part 100 150 because values in count
greater 100.
i think set y-axis base 100 in case. hope can help.
try
m1 <- matrix(df1[,2], ncol=3, dimnames=list(null, df1[,1])) barplot(m1, ylim=c(100,150), beside=true, xpd=false)
or
library(ggplot2) ggplot(df1, aes(x=name, y=count))+ geom_bar(stat='identity')+ coord_cartesian(ylim=c(100,150)) + theme_bw() + xlab(null) + ylab(null)
data
df1 <- structure(list(name = c("a", "b", "c"), count = c(110l, 120l, 130l)), .names = c("name", "count"), class = "data.frame", row.names = c(na, -3l))
Comments
Post a Comment