I am trying to plot a combination of scatter plot and time series, where each time series curve belongs to its corresponding point in the scatter plot. I want to have an interactive plot and I use altair for that purpose. I use exactly the same code that is shared in altair (here: Selection Detail Example — Altair 4.2.0 documentation) to create such interactive plot. When I run this code on my local computer, everything works very well. However, when I deploy the code and show it in share.streamlit.io, the time series are not synched with the scatterplot anymore. In fact, when all the points are selected, the time series is shown well for all points. However, as soon as I choose one specific point in the scatterplot, the time series disappear totally.
This problem is shown in the attached figures. I appreciate any hints/ comments about this problem.
Hi @mhajizadeh, welcome to the Streamlit community!!
When I run this code on my local computer, everything works very well.
What version of Streamlit are you using? I tried all versions from 0.85.0, 0.86.0, …, to 1.3.1 and wasn’t able to reproduce the behavior where it “works well”. Clicking on any point in the scatterplot, locally and on Streamlit Cloud, causes the time series to disappear.
Hi @snehankekre. Thanks for your reply. I use streamlit 1.3.1.
I know that it works with hist plots, but I am interested in plotting time-series and not bar plots. Do you have any recommendations about this?
@mhajizadeh I don’t know that I have your answer, but I came across two issues with Streamlit + Altair.
First, my local computer is Windows and Streamlit host is Linux. If you’re manipulating datetimes to strftime, Windows has at least one specific difference from Linux that was causing a bug in my code.
Otherwise, if you are using Altair to set ordinal time series values (i.e. skip weekend dates), this has caused some Altair interactivity issues for me.
@ryanlampkin thanks for your hints. Actually my local computer is Windows and that might be what you mentioned. My time data are not datetimes format, but are continuous numbers exactly as the one used in altair example, so lets consider them as a continuous range of (0,50). I do not specify their time neither as ordinal (O) nor as time (T). However, if I define the x and Y as T, it does not solve my problem.
I am curious to know how you overcome the problem of conflicts between windows and Linux version. Can you please share this?
That’s helpful to know. Yes, I don’t think our problems are the same. For datetime formatting, in my issue, Windows uses a # where linux required a -. Small but took me forever to figure out
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.