alonsh
June 29, 2023, 8:59am
1
There is a new ‘labelalias’ argument in plotly 5.15.0
If I am using the script in the example but add it into streamlit:
import plotly.express as px
import pandas as pd
import streamlit as st
df = px.data.tips()
df = (
df[df.day.isin(["Sat", "Sun"])]
.groupby(by="day", as_index=False)
.sum(numeric_only=True)
)
fig = px.bar(df, x="day", y="total_bill")
fig.update_xaxes(labelalias=dict(Sat="Saturday", Sun="Sunday"))
st.plotly_chart(fig)
fig.show()
st.plotly_chart(fig) shows it in streamlit, and the labelalias is not working
the fig.show() opens it in a new tab, where the labelalias is working
I dont know if this is the reason, but I have noticed that
the fig.show() uses plotly.js 2.24.1 to view the plot
while within streamlit, the st.plotly_chart(fig) uses plotly 2.18.1 to view the plot
how can I fix that?
can I control which plotly.js version is used to render the plots?
marduk
July 19, 2023, 5:09pm
5
Hi @alonsh ,
You cannot control the plotly.js version used by Streamlit, and this is probably why you cannot use the new plotly feature yet. Streamlit dependencies are updated every now and then, but my suggestion is that you open an enhancement request on GitHub. Share the link here so people know and add thumbs up to the request to express interest
alonsh
July 20, 2023, 11:17am
6
opened 11:17AM - 20 Jul 23 UTC
closed 07:18AM - 03 Oct 23 UTC
type:enhancement
area:dependencies
feature:st.plotly_chart
When rendering plotly figures using streamlit, it uses plotly.js version 2.18.1
…
Some new plotly features only appear when using the newer plotly.js version.
If it is possible to update this soon so we can use the newer plotly features :)
give thumbs up if this is also relevant for you
2 Likes
system
Closed
July 22, 2023, 11:17am
7
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.