What is the altair equivalent of st.line_chart?

Per the documentation, st.line_chart is a wrapper on an altair function. What is the raw altair code that will exactly replicate what st.line_chart does?


You can find more info here and here for how st.line_chart() is implemented!

Thank you for the reply.

Do you know of anyway to adjust the scale of the line chart?The default is 0 to 1, but it should be the minimum y-axis point to the maximum y-axis point?


So I have found that st.line_chart() works really well when I don’t need to be too specific about how the graph exactly looks, but when I need to do things like make the scale something very specific, I’ll use altair directly. So an example for changing the scale might be:

    x = alt.X('my_column_name')
    y = alt.Y('my_y_col_name', scale=alt.Scale(domain=[0, 50]))

where 50 is the upper bound.

Also line_chart should automatically adjust the upper bound for you, does it only go to 0,1?

Thanks so much for the help thus far, unfortunately altair is just out of the range of my current skillset so I will have to find another solution. I also thought that the data would automatically scale, but nope.

I posted a picture of this problem in a different post: Scale y-axis using st.line_chart [Please?]

Ah ok! Well we’ll try to answer your question in the other post after you post your code.