Search code examples
altair

Altair: Boxplot with round corners


For a bar chart, I can set round corners in the following way:

alt.Chart(
  ...
).mark_bar(
  cornerRadiusTopLeft=4,
  cornerRadiusTopRight=4
).encode(
...
)

Is it somehow possible to do the same for boxplots (of course for all four corners)?

Thank you!


Solution

  • You can specify the box argument using a dict, like below:

    alt.Chart(source).mark_boxplot(box={'cornerRadius':8}, extent='min-max').encode(
        x='age:O',
        y='people:Q'
    )
    

    enter image description here