Scale y-axis using st.line_chart [Please?]

I have a line graph that I would like to look like this, instead of this. The goal image is first, the default image is the second.


Please assume that I cannot use altair, plotly, or matplotlib.

Is my best bet just to write in text that the end-user should scroll to zoom in? That would come off as rather unsophisticated.

Hi @Mantis4995,

Is there supposed to be text in the first screenshot? Can you clarify what you’re trying to implement and what your code looks like currently?

No, the screenshots are just a zoomed-in line graph, and the same graph but zoomed out (which is the default).

I wanted to know if there was a way to be zoomed in automatically. Currently My data is between 1 and 0.95 to 1.05, but the default scale before zooming in is -0.2 to 1.

The code is just:

st.line_chart(data = Big_Data[[‘Communications’,‘CD Consumer Discretionary’]])

which just plots a line chart of two columns.

Can you share your current code?

@Mantis4995 The chart should automatically adapt to the min/max values of your data. Can you double-check that there’s not a small/large value in your data somewhere? If this persists, can you share the entire code + your data if possible?

1 Like

Yes, thank you for the response, here is a detailed replication:

Data:

Full data for replication sake: Put Quotetime Communications CD Consumer Discretionary2022-09-09 13:30:19.335 - Pastebin.com

Output:

The axis remains the same even when plotting one column. The ideal scenario would be to have the line chart’s y-axis autofit.

Thank you

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.