如何可视化分层数据?

时间:2022-04-05 06:59:55

I have some data like the following:

我有一些如下数据:

A A1 12
A A2 23
A A3 AA1 1
A A3 AA2 2
B B1 2
B B2 1

Is there a way to visualize this information in ggplot? I am looking for something like this:

有没有办法在ggplot中可视化这些信息?我正在寻找这样的东西:

   |--A1---12
   |--A2---23
A--|--A3--AA1--1
      |---AA2--2

B--|--B1---2
   |--B2---1

Any suggestions?

有什么建议么?

3 个解决方案

#1


4  

Take a look at Rgraphviz, which can allow you to visualize graphs (including trees), using different schemes for your nodes.

看看Rgraphviz,它可以让您使用不同的节点方案可视化图形(包括树)。

#2


3  

Are you set on using ggplot? Personally, I would not process this kind of data in R since it's not really of statistical nature. I would rather write a python script to build a tree/forest, and view it using one of the many excellent graph visualization tools out there, e.g. Gephi.

你开始使用ggplot吗?就个人而言,我不会在R中处理这种数据,因为它不具有统计性​​质。我宁愿编写一个python脚本来构建一个树/森林,并使用其中一个很好的图形可视化工具来查看它,例如Gephi。

#3


3  

Check out the function sizetree() in the plotrix package.

查看plotrix包中的函数sizetree()。

also treemaps make allow nice visualizations, see package treemap

树图也允许很好的可视化,请参阅包树图

finally check out either the javascript library protovis or d3js, both have great possibilities for visualizing hierarchies. it is a bit tedious to get the data in there though...

最后查看javascript库protovis或d3js,两者都有可视化层次结构的可能性。虽然在那里获取数据有点乏味......

#1


4  

Take a look at Rgraphviz, which can allow you to visualize graphs (including trees), using different schemes for your nodes.

看看Rgraphviz,它可以让您使用不同的节点方案可视化图形(包括树)。

#2


3  

Are you set on using ggplot? Personally, I would not process this kind of data in R since it's not really of statistical nature. I would rather write a python script to build a tree/forest, and view it using one of the many excellent graph visualization tools out there, e.g. Gephi.

你开始使用ggplot吗?就个人而言,我不会在R中处理这种数据,因为它不具有统计性​​质。我宁愿编写一个python脚本来构建一个树/森林,并使用其中一个很好的图形可视化工具来查看它,例如Gephi。

#3


3  

Check out the function sizetree() in the plotrix package.

查看plotrix包中的函数sizetree()。

also treemaps make allow nice visualizations, see package treemap

树图也允许很好的可视化,请参阅包树图

finally check out either the javascript library protovis or d3js, both have great possibilities for visualizing hierarchies. it is a bit tedious to get the data in there though...

最后查看javascript库protovis或d3js,两者都有可视化层次结构的可能性。虽然在那里获取数据有点乏味......