简体   繁体   English

在Altair图表中隐藏构面标题?

[英]Hide facet title in Altair chart?

Given a simple, faceted chart like: 给定一个简单的多面图表,例如:

import altair as alt

data = alt.Data(values = [
    { "category" : "a", "x" : 1, "y" : 2 },
    { "category" : "a", "x" : 2, "y" : 4 },
    { "category" : "b", "x" : 1, "y" : 3 },
    { "category" : "b", "x" : 2, "y" : 5 }
])

alt.Chart(data).mark_point().encode(x = "x:Q", y = "y:Q").facet(
    row = "category:O"
)

How do you hide the top-level "category" title along the y axis (while keeping the "a" and "b" labels)? 如何沿y轴隐藏顶级“类别”标题(同时保留“ a”和“ b”标签)?

图表

You can set the title property of the encoding to None : 您可以将编码的title属性设置为None

alt.Chart(data).mark_point().encode(x = "x:Q", y = "y:Q").facet(
    row = alt.Row("category:O", title=None)
)

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM