Learning Curve: Advantage Streamlit Aesthetics Having said that, as far as learning curve go, this means that Streamlit is easier to pick up and get going with.Īs another point, if you are looking to use a graphics package that is not Plotly, adopting Streamlit means you can continue to use that and not have to learn Plotly. To be clear, neither philosophy isn’t inherently better than the other - these are design choices. You’ll notice for example that in Streamlit, the command st.write() can be used to add a Plotly figure, or to simply add body text. You’ll notice that the Streamlit version of the script is shorter, it flows more linearly (I didn’t need to build additional functions, or callbacks - we’ll come back go this point later), and the functions are not related to the underlying html that is used to render the page.ĭash is slightly more verbose than Streamlit, whereas Streamlit takes care of more decisions for you so that the user can concentrate on building the data science / analysis aspect. Our basic web app, now built with Streamlit (Image by author) With the caveat that the Streamlit script needs to be run externally with a shell command: streamlit run This is the code needed to generate a fully functioning Dash app: import dash import dash_html_components as html import dash_core_components as dcc app = dash.Dash(_name_) app.layout = html.Div() if _name_ = '_main_': app.run_server(debug= True)Īnd this is the code needed to produce the same graph in Streamlit, import streamlit as st st.write(fig) So what’s the learning curve like? Learning curve - for the absolute minimumīoth of them do a great job by making it super simple to spin up a web app. If you are here, you might be relatively new to both (or at least one). If you want to see the code, you can find the accompanying git repo here. import json import aph_objects as go with open("srcdata/fig.json", "r") as f: fig = go.Figure(json.load(f)) To evaluate the dashboarding aspect only, we simply load an existing figure from a JSON file, and build our web app around it. Install each (in your virtual environment) with a simple pip install. To follow along, install a few packages - plotly, dash, dash-bootstrap-components and streamlit. As such, and the choice of the right tool might be dependent on your use case, as well as your background. What all that means is that I think they are both amazing tools, built for slightly different purposes. Examples of using third party libraries can be found here. Note : I erroneously indicated in an earlier version of this article that Dash was only compatible with Plotly - this was incorrect. Second, Dash is primarily designed to work with Plotly, whereas Streamlit is more agnostic to the underlying visualisation libraries such as Altair, Bokeh, Plotly, Seaborn, or Matplotlib. And as you will see below, this leads to some design decisions and functionality differences. An observation of their websites (screenshots from late July 2020) really confirm this hypothesis. One, Streamlit appears to be more aimed towards rapidly prototyping an app, whereas Dash appears more directed at a production / enterprise environment. In the spirit of data visualisation, the next chart tells the story so far.ĭash vs Streamlit - the websites tell the story (Image by author, screenshots from / streamlit.io) So in this post, I compare a couple of leading data dashboarding packages - namely, Plotly’s Dash, which is arguably the industry leader in this space, and a newer entrant to the scene called Streamlit. In addition, if you want to share your outputs as web apps or add interactivity, the search and research criteria become more complex, adding further difficulty to the search and research. That’s not even counting those in other languages, like D3.js, ggplot2 or Highcharts.įinding them, and then going on to do research on each package to compare their pros and cons can be exhausting. There exists a ton of amazing tools like Plotly, Altair, Bokeh and the classics such as matplotlib, seaborn and ggplot. This holds true even for a relative niche field of data visualisation for Python. They say that there’s always a right tool for the job.īut we all know that practicalities are not sayings, and in most cases, finding the right tool is no trivial task. Dash or Streamlit to generate web apps? (Image by author, right chart from star history)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |