質問

I would like to make a ggplot graph with Period on the x-axis like 2010-01, 2010-02 ..., 2014-03

And my code are like followings:

 ggplot(Result, aes(x=factor(Period), y=No_Seats, colour=Airline, group=Airline)) + geom_line()

And the graph is like this: enter image description here

As you can see we can see the period label clearly. I like to make the period a vertical label. Thanks!

役に立ちましたか?

解決

add

+ theme(axis.text.x =  element_text(angle=90))

他のヒント

You could use the scales library and provided x-axis is a date you can use something like

scale_x_date(breaks=Dbreaks,labels=date_format("%Y"))

Where Dbreaks is your specified breaks (most be date breaks otherwise it won't work) and format how you would want it to be printed. With the same library you can specify your breaks. For example

Dbreaks <- seq(as.Date("2006-06-01"),as.Date("2013-06-1"),by='1 year').

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top