-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
【特性】图表类型支持:韦恩图 #5038
Comments
venn 的实现有两种方式: 1. 新增 venn markconst data = [
{ sets: ['A'], size: 12, label: 'A' },
{ sets: ['B'], size: 12, label: 'B' },
{ sets: ['A', 'B'], size: 2, label: 'A&B' },
];
chart
.venn()
.data(data)
.encode('sets', 'sets')
.encode('size', 'size')
.encode('color', 'label') // default: sets.join('&')
.style('blendMode', 'multiply'); // 多种可选
chart.render() 2. 结合布局,使用 path mark 实现,不添加单独的 markconst data = [
{ sets: ['A'], size: 12, label: 'A' },
{ sets: ['B'], size: 12, label: 'B' },
{ sets: ['A', 'B'], size: 2, label: 'A&B' },
];
chart
.path()
.data({
type: 'inline',
value: data,
transform: [{
type: 'venn',
sets: 'sets',
value: 'value',
blendMode: 'multiply',
}],
})
.encode('d', 'd')
.encode('color', 'color')
.style('blendMode', 'multiply'); // 多种可选
chart.render() |
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"values": [
{"category": 1, "x": -10, "y": 0},
{"category": 2, "x": 10, "y": 0},
{"category": 3, "x": 0, "y": 4}
]
},
"view": {"stroke":"transparent"},
"mark": "circle",
"encoding": {
"x": {"field": "x", "type": "quantitative"
,"axis":null},
"y": {"field": "y", "type": "quantitative", "axis":null},
"color": {"field": "category", "type": "nominal",
"legend": {"orient": "none", "legendX":300, "legendY":-100}},
"size":{"value":100000}
}
}
# install.packages("ggVennDiagram")
library(ggVennDiagram)
# List of items
x <- list(A = 1:5, B = 2:7, C = 5:10)
# Venn diagram with percentages
ggVennDiagram(x,
label = "percent") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: