可视化其他时间的变化

数据挖掘 可视化 工具
2022-02-20 13:03:07

我正在分析人口流动模式,我想设计一个像这样的可视化:

所需的样本数据可视化。

我可以为此目的使用任何工具语言(最好是 R)吗?

是我的数据集的示例。

2个回答

当然,您可以使用一些来重现该图ggplot

在此处输入图像描述

这是创建它的代码:

library(ggplot2)
library(scales)

df <- read.csv2('Graphs_SK.csv')    

p <- ggplot(data = df, aes(x = Governorate)) +
  geom_segment(aes(y = Mid.May.2015, yend = Dec.16, xend = Governorate),
               color = 'grey', size = 1) +
  geom_point(aes(y = Mid.May.2015, color = 'start'), size = 2) +
  geom_point(aes(y = Dec.16, color = 'end'), size = 2) +
  scale_colour_manual(name = '(Population in millions)', 
                      labels = c('May 2015', 'Dec 2016'), 
                      values = c('start' = 'steelblue4', 'end' = 'steelblue')) +
  scale_y_continuous(labels = comma, name = '', position = 'top') +
  coord_flip() +
  ggtitle('1 Year of something of Governorate') +
  guides(colour = guide_legend(title.position = 'right')) +
  theme(panel.background = element_rect(fill = 'white'),
        legend.position = c(-.15, 1.03),
        legend.direction = 'horizontal',
        legend.justification = c(0, 0),
        legend.key = element_rect(fill = NA),
        legend.title = element_text(size = 10),
        axis.text.y = element_text(hjust = 0),
        axis.ticks.y = element_line(size = NA), 
        plot.title = element_text(hjust = .5))

甘特图是您所需要的。有许多支持甘特图的可视化库。

查看这篇文章:https ://stackoverflow.com/questions/3550341/gantt-charts-with-r