如何找到 Altair 默认调色板的十六进制表示?每个绘图工具都有其优点和缺点,我通常最终生成由 Seaborn + Altair 组成的可视化。我想在 Seaborn 中匹配 Altair 颜色。对于 Seaborn,您可以获得 color_palette 的相关 HEX 颜色表示如下,并且想知道如何在 Altair 中获得类似的颜色信息。
import seaborn as sns
sns.color_palette('Set2').as_hex()
Out[131]:
['#66c2a5',
'#fc8d62',
'#8da0cb',
'#e78ac3',
'#a6d854',
'#ffd92f',
'#e5c494',
'#b3b3b3']
Run Code Online (Sandbox Code Playgroud) 我想在下面的Altair图中将X轴(或Y轴)fontSize增加到16(或任何值)。我在此处的Altair文档中找不到任何示例:https : //altair-viz.github.io/index.html。我正在使用Jupyter Lab进行可视化。直观地alt.Axis应该采用FontSize参数
import altair as alt
from vega_datasets import data
cars = data.cars()
alt.Chart(cars).mark_point().encode(
alt.X('Horsepower', axis=alt.Axis(title="HORSEPOWER")),
alt.Y('Miles_per_Gallon', axis=alt.Axis(title="Miles Per Gallon")),
color='Origin',
shape='Origin'
)
Run Code Online (Sandbox Code Playgroud)