r语言这张图改的好看一点 ```{r} month=global3 %>% group_by(Month,movement_type) %>% summarise(count=n()) month$Month<-as.character(month$Month) ####创建净流入表并合并 month1<-data.frame(Month=c("2019-01-01","2019-02-01","2019-03-01","2019-04-01","2019-05-01","2019-06-01","2019-07-01","2019-08-01","2019-09-01"), movement_type=c("净流入"), count=c("1","-4","5","2","4","11","5","14","8")) month1$count<-as.integer(month1$count) month<-rbind(month,month1) t4<-echartr(month, Month, count,movement_type, type='line') %>% setTitle('月变动情况')%>% setSymbols('emptycircle')%>% setTheme("macarons")%>% setToolbox(show=FALSE) t4 ```
时间: 2023-07-18 09:38:12 浏览: 135
右上方小图-v833/v831_datasheet_v1.0
可以尝试以下修改:
```{r}
library(ggplot2)
library(dplyr)
month <- global3 %>%
group_by(Month, movement_type) %>%
summarise(count = n()) %>%
ungroup() %>%
mutate(Month = format(as.Date(Month), "%Y-%m"))
month1 <- data.frame(Month = c("2019-01", "2019-02", "2019-03", "2019-04", "2019-05", "2019-06", "2019-07", "2019-08", "2019-09"),
movement_type = c("净流入"),
count = c(1, -4, 5, 2, 4, 11, 5, 14, 8))
month1$count <- as.integer(month1$count)
month <- rbind(month, month1)
ggplot(month, aes(x = Month, y = count, color = movement_type)) +
geom_line(size = 1.2) +
labs(title = "月变动情况") +
scale_color_manual(values = c("#0072B2")) +
theme_minimal() +
theme(plot.title = element_text(hjust = 0.5))
```
这里使用 `ggplot2` 作图,并对数据做了一些预处理,让图更加美观和易读。
阅读全文