Python 如何展开牵牛星图中的所有图例条目
考虑以下简单示例:Python 如何展开牵牛星图中的所有图例条目,python,legend,altair,Python,Legend,Altair,考虑以下简单示例: import altair as alt from vega_datasets import data alt.Chart(data.cars.url).mark_point().encode( x='Horsepower:Q', y='Miles_per_Gallon:Q', color=alt.Color('Name:N', legend=alt.Legend(columns=8)) ).properties( # Adjust char
import altair as alt
from vega_datasets import data
alt.Chart(data.cars.url).mark_point().encode(
x='Horsepower:Q',
y='Miles_per_Gallon:Q',
color=alt.Color('Name:N', legend=alt.Legend(columns=8))
).properties(
# Adjust chart width and height to match size of legend
width=600,
height=600
)
输出此图表
我想做的是扩展这271个条目
我一直在寻找这个有一段时间了,现在无法找到如何。这可能吗
谢谢:)您可以使用
symbolimit
指定要显示的图例符号的最大数量,默认值为30。如果设置为零,将显示所有符号:
import altair as alt
from vega_datasets import data
alt.Chart(data.cars.url).mark_point().encode(
x='Horsepower:Q',
y='Miles_per_Gallon:Q',
color=alt.Color('Name:N', legend=alt.Legend(columns=8, symbolLimit=0))
).properties(
# Adjust chart width and height to match size of legend
width=600,
height=600
)