altair
altair copied to clipboard
Legend placement on facet chart
Trying to orient a legend on a faceted chart does not seem to work properly.
dat = pd.DataFrame(dict(
one = [1,2,3,4],
two = ["1","1","2","2"],
three = [1,4, 9, 16]))
alt.Chart(dat).mark_line().encode(
x="one",
y="three",
color="two").facet("two").configure_legend(orient="bottom-right")
This should result in the legend being placed on the bottom right, inside the plot, but instead it is at the top left, outside the plot. I get the same behaviour when I directly encode it using altair.Legend inside altair.Color. With facet removed it works fine.
This is on altair 4.1.0 with jupyterlab 2.1.2.
This looks like a bug in Vega/Vega-Lite. I'd suggest reporting the issue there.
VL issue here https://github.com/vega/vega-lite/issues/3931
Closing this as there is nothing to do on the Altair side of things. Once the functionality has been implemented in VL, it will be in an upcoming Altair release.