I have a rather simple bar chart, created with the Python altair library, based on a Pandas DataFrame.
The code to generate the chart is:
Chart(df).configure(background='white').mark_bar().encode(
X('user_id', bin=Bin(maxbins=10), title='Subscriber count'),
Y('count(*)', title='Number of publications')
)
Which translates to the following vega-lite syntax:
{
"encoding":
{
"x":
{
"bin":
{
"maxbins": 10
}, "field": "user_id",
"title": "Subscriber count",
"type": "quantitative"
},
"y":
{
"aggregate": "count",
"field": "*",
"title": "Number of publications"
}
},
"mark": "bar"
}
The only thing I'd like to add, are the actual values in (or on) each bar, preferably rotated 90° counter-clockwise.
So far, I've only been able to find the mark_text feature, which might be an option if I used layering, but I can't find how to rotate the text. Of course, if there's a better way (or if it's not possible at all), do tell!
Thanks!
