Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在Altair中的每个镶嵌面子地块中显示x和y标签_Python_Altair - Fatal编程技术网

Python 在Altair中的每个镶嵌面子地块中显示x和y标签

Python 在Altair中的每个镶嵌面子地块中显示x和y标签,python,altair,Python,Altair,我指的是: 这将生成一个包含3个子地块的绘图,其中x轴和y轴共享。我希望每个子地块都有自己的x和y标签(即使重复)。如何实现这一点?您可以使用以下内容中讨论的方法实现这一点: import altair as alt from vega_datasets import data iris = data.iris() alt.Chart(iris).mark_point().encode( x='petalLength:Q', y='petalWidth:Q', col

我指的是:

这将生成一个包含3个子地块的绘图,其中x轴和y轴共享。我希望每个子地块都有自己的x和y标签(即使重复)。如何实现这一点?

您可以使用以下内容中讨论的方法实现这一点:

import altair as alt
from vega_datasets import data
iris = data.iris()

alt.Chart(iris).mark_point().encode(
    x='petalLength:Q',
    y='petalWidth:Q',
    color='species:N'
).properties(
    width=180,
    height=180
).facet(
    facet='species:N',
    columns=2
)
import altair as alt
from vega_datasets import data
iris = data.iris()

alt.Chart(iris).mark_point().encode(
    x='petalLength:Q',
    y='petalWidth:Q',
    color='species:N'
).properties(
    width=180,
    height=180
).facet(
    facet='species:N',
    columns=2
).resolve_axis(
    x='independent',
    y='independent',
)