我正在寻找可以创建以下图形的程序或库:
想法如下:
是否可以在Wolfram Mathematica
中生成这样的图像?如果是,我应该使用哪些功能。
此图上显示的图形显示了Tinder应用程序的使用历史。
来源:
https://www.reddit.com/r/dataisbeautiful/comments/83ttdq/oc_my_28_days_on_tinder/
答案 0 :(得分:0)
我决定不使用Mathematica
,而是在JavaScript
中创建此图。
https://www.amcharts.com/docs/v4/chart-types/sankey-diagram/
/**
* ---------------------------------------
* This demo was created using amCharts 4.
*
* For more information visit:
* https://www.amcharts.com/
*
* Documentation is available at:
* https://www.amcharts.com/docs/v4/
* ---------------------------------------
*/
// Create chart instance
var chart = am4core.create("chartdiv", am4charts.SankeyDiagram);
chart.data = [
{ "from": "A", "to": "D", "value": 10 },
{ "from": "B", "to": "D", "value": 8 },
{ "from": "B", "to": "E", "value": 4 },
{ "from": "C", "to": "E", "value": 3 },
{ "from": "D", "to": "G", "value": 5 },
{ "from": "D", "to": "I", "value": 2 },
{ "from": "D", "to": "H", "value": 3 },
{ "from": "E", "to": "H", "value": 6 },
{ "from": "G", "to": "J", "value": 5 },
{ "from": "I", "to": "J", "value": 1 },
{ "from": "H", "to": "J", "value": 9 }
];
chart.dataFields.fromName = "from";
chart.dataFields.toName = "to";
chart.dataFields.value = "value";
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
#chartdiv {
width: 100%;
height: 300px;
}
<script src="//www.amcharts.com/lib/4/core.js"></script>
<script src="//www.amcharts.com/lib/4/charts.js"></script>
<script src="//www.amcharts.com/lib/4/themes/animated.js"></script>
<div id="chartdiv"></div>