Reputation: 2072
I would like to do a simple graph like this:
ff<-data.frame(Freq=c(rep(10000,10),rep(100,15),rep(10,50),rep(1,100)))
plot(log(ff$Freq),type="l")
is the only option to add a x variable?
require(ggplot2)
ff$Ord <- 1:nrow(ff)
ggplot(data=ff,aes(x=Ord,y=log(Freq))) + geom_line()
thanks in advance
Upvotes: 2
Views: 1283
Reputation: 762
Here's one approach with geom_step():
library(ggplot2)
library(scales)
ggplot(ff, aes(x = seq_along(Freq), y = log10(Freq))) + geom_step(size = 1) +
labs(x = "Index", y = "Freq") +
scale_y_continuous(labels = math_format(10^.x))
Upvotes: 3