altair - Altair Changing legend color
问题描述
I am trying to change the colors of the selected fields that I have highighted red in the image below but I am unsure about how exacly I would do it. I am trying to update the chart legend text color and allso the titles of the data sources color.
chart = alt.Chart(df).mark_text(align='center', fontSize=48, fontWeight=200, opacity=0.5, text='foo-baz').mark_bar().encode(
# tell Altair which field to group columns on
x=alt.X('c2:N', title=None),
# tell Altair which field to use as Y values and how to calculate
y=alt.Y('sum(values):Q',
axis=alt.Axis(
grid=False,
title='LOC added')),
# tell Altair which field to use to use as the set of columns to be represented in each group
column=alt.Column('c1:N', title=None),
# tell Altair which field to use for color segmentation
color=alt.Color('Language:N',
scale=alt.Scale(
domain=all_languages,
# make it look pretty with an enjoyable color pallet
range=allColorsValues,
),
)).configure(background='transparent')\
.configure_view(
# remove grid lines around column clusters
strokeOpacity=0,
).configure_axis(
labelColor='white',
titleColor='white'
).configure_legend(
strokeColor='gray'
)
解决方案
推荐阅读
- development-environment - wix 中的库存检查器 api
- action - ThingsBoard:如何在点击时打开对话框
- python - 如果条件在 python 烧瓶中的 jinja 中不起作用
- knockout.js - 剔除模板仅显示最后一个值
- python - 如何在excel中插入行
- android - DiffUtil ItemCallback areContentsTheSame() 在更新 ListAdapter 上的项目后始终返回 true
- java - 如何使用 java 在 sonatype nexus3 中删除未使用的工件并重建索引?
- python - 如何找到最高百分比的 GC 内容,包括其 ID?
- google-apps-script - 用于 whenNumberLessThanOrEqualTo(string) 的 Google 表格脚本条件格式
- c# - Puppeteer C#:连接到正在运行的 Chrome 实例