{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"description": "Markov Chain Process",
"width": 500,
"height": 300,
"data": [
{
"name": "states",
"values": [
{
"state": "Sunny",
"probability": 0.7
},
{
"state": "Cloudy",
"probability": 0.2
},
{
"state": "Rainy",
"probability": 0.1
}
]
},
{
"name": "transitions",
"values": [
{
"from": "Sunny",
"to": "Sunny",
"probability": 0.7
},
{
"from": "Sunny",
"to": "Cloudy",
"probability": 0.2
},
{
"from": "Sunny",
"to": "Rainy",
"probability": 0.1
},
{
"from": "Cloudy",
"to": "Sunny",
"probability": 0.4
},
{
"from": "Cloudy",
"to": "Cloudy",
"probability": 0.5
},
{
"from": "Cloudy",
"to": "Rainy",
"probability": 0.1
},
{
"from": "Rainy",
"to": "Sunny",
"probability": 0.2
},
{
"from": "Rainy",
"to": "Cloudy",
"probability": 0.3
},
{
"from": "Rainy",
"to": "Rainy",
"probability": 0.5
}
]
}
],
"scales": [
{
"name": "color",
"type": "linear",
"domain": [
0,
1
],
"range": [
"blue",
"red"
]
}
],
"marks": [
{
"type": "rect",
"from": {
"data": "states"
},
"properties": {
"fill": {
"scale": "color",
"field": "probability"
},
"x": {
"field": "state"
},
"y": {
"value": 0
},
"width": {
"value": 50
},
"height": {
"value": 50
}
}
},
{
"type": "line",
"from": {
"data": "transitions"
},
"properties": {
"stroke": {
"value": "black"
},
"strokeWidth": {
"value": 2
},
"from": {
"field": "from"
},
"to": {
"field": "to"
},
"x": {
"field": "probability"
}
}
}
]
}