【发布时间】:2019-12-20 05:07:46
【问题描述】:
我想使用 ggplot 生成每个年季度的时间图,但 x 轴上只显示年份。 Q1、Q2、Q3、Q4都不见了?如何解决这个问题呢。
> head(X02_4m_bb)
# A tibble: 6 x 7
Year Quarter Revenue CGS Gross_Profit_M Disp_Income_B YQ
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <yearqtr>
1 1995 1 1275. 1080. 195. 16351. 1995 Q1
2 1995 2 1438. 1228. 210. 16481. 1995 Q2
3 1995 3 1929. 1672. 257. 16695. 1995 Q3
4 1995 4 2576. 2246. 329. 16865. 1995 Q4
5 1996 1 1637. 1387. 250. 17122. 1996 Q1
6 1996 2 1779. 1510. 268. 17400. 1996 Q2
ggplot(X02_4m_bb, aes(x=YQ, y=Revenue, group=1)) +
geom_line()
【问题讨论】:
-
如果只是关于 x 轴上的标签,这可能会提供一些想法:ggplot2.tidyverse.org/reference/scale_date.html