@snehankekre, sorry for the late response. It didn’t work for me. A snippet of my code is:
mdf = st.session_state.dflst[st.session_state.vsidx].copy()
ux = st.session_state.dflst[st.session_state.vsidx].get(“VISIT PVAL”).max(axis = 0) + 1 # incr y cood axis scale by 1 so plotting does not touch top of graph
cht1 = alt.Chart(mdf[(mdf[“SCNID”] == tmpsid) & (mdf[“VISIT PARAMETER”] == tmpparam)])
cht1 = cht1.mark_line(color = “blue”, point = True)
cht1 = cht1.encode(alt.X(“VISIT”, title = “Visit”), alt.Y(“LOW”, title = “Visit Value”, scale = alt.Scale(domain=(0, ux))))
# cht1 = cht1.encode(alt.Color(‘VISIT:N’))
cht1 = cht1.properties(width = 500, height = 300, title = “Reading per Visit”)
cht2 = alt.Chart(mdf[(mdf["SCNID"] == tmpsid) & (mdf["VISIT PARAMETER"] == tmpparam)])
cht2 = cht2.mark_line(color = "orange", point = True)
cht2 = cht2.encode(alt.X("VISIT", title = "Visit"), alt.Y("VISIT PVAL", title = "Visit Value", scale = alt.Scale(domain=(0, ux))))
# cht2 = cht2.encode(alt.Color('VISIT:N'))
cht2 = cht2.properties(width = 500, height = 300, title = "Reading per Visit")
cht3 = alt.Chart(mdf[(mdf["SCNID"] == tmpsid) & (mdf["VISIT PARAMETER"] == tmpparam)])
cht3 = cht3.mark_line(color = "red", point = True)
cht3 = cht3.encode(alt.X("VISIT", title = "Visit"), alt.Y("HIGH", title = "Visit Value", scale = alt.Scale(domain=(0, ux))))
# cht3 = cht3.encode(alt.Color('VISIT:N'))
cht3 = cht3.properties(width = 500, height = 300, title = "Reading per Visit")
cht = alt.layer(cht1, cht2, cht3)
cht = cht.configure_title(fontSize=20, font="Courier", anchor="start", color="red")
st.altair_chart(cht, use_container_width=True)
# st.write(cht)
st.markdown('<span style="color:black">Legend Colour: </span><span style="color:red">Upper Limit, </span><span style="color:orange">Visit Value, </span><span style="color:blue">Lower Limit</span>', unsafe_allow_html=True,)
Maybe, I am missing something…
Shawn