문법 익힐겸, 무의미한 데이터를 만들어서 그림을 그려본다

단순히 랜덤 값으로 data frame 을 구성하고, y축 값을 sort 해서 step 을 그리는 구문이다



# load library
library ("ggplot2")

# set data frame with x and y
# y is random from 10 to 20
d = data.frame(x=1:100, y=runif(100, min=10, max=20))

# sort data of y
d$y = sort(d$y)

# draw step
p = ggplot(d, aes(x, y))
p + geom_step()



+ Recent posts