Using the default configuration, points in Altair plots are sometimes cut off at the edges of a chart (here left and top): Example Altair chart
这是编制图表的法典:
df = pd.DataFrame({
"X": [0.01, 0.05, 0.1, 3.0, 3.1, 3.2],
"Y": [1.0, 1.1, 1.2, 2.9, 2.98, 2.99]
})
chart = alt.Chart(
df,
).mark_point().encode(
x= X ,
y= Y ,
).properties(
width=400,
height=350
).interactive()
chart
I have read about clip
, clamp
and padding
, but they do not fit my needs.
With clip
users of the chart (when it is interactive) can move the plot outside the chart window, which I would like to prevent. clamp
is a different form of visualization, also not what I want here. And with padding
I get inconsistent results with the data points then sometimes being very far away from the axes.
So my question is, how can I globally configure Altair to always show all points in full? Hopefully, there is a way to achieve this that does not require manually setting the scale domains every time. Thanks a lot for your help.
Kind regards,
Axel