For each chapter in Finding Ghosts in Your Data, I’ll include a few resources that I found interesting. This isn’t a bibliography, strictly speaking, as I might not use all of these in the course of writing, but they were at least worth noting.

Streamlit

Chapter 8 was all about visualization and ended up being an ode to Streamlit. Speaking of odes to Streamlit, I wrote a post on getting started with the product and you can see a little bit of how it all works.

You might want to start with the basics of Streamlit but keep the cheat sheet handy; I referred to it a lot during development, as it provided not only a quick reference of what a particular function is but it also gives you an idea of the types of things you can do with the library.

In the process of writing this chapter, I went through a couple of guides on getting started with Streamlit, as well as combining Streamlit with FastAPI. It turns out that the answer for the latter is “just make the API calls.” Displaying graphics with Streamlit is pretty easy and I’d recommend jumping to Plotly instead of trying to do much of this in matplotlib. Here’s an example of using both Seaborn and Plotly in a Streamlit page.

When using Plotly, one thing I spent a lot of time struggling with was defining hover text, as I wanted to include the results of various statistical tests for each data point. It turns out that you can customize the hover text.

All in all, I was quite pleased with Streamlit for the work I needed to do. I didn’t dive into many of the aspects of “real” web app dev, such as working with CSS, incorporating multiple views, or writing any custom JavaScript. For my purposes—building a simple, single-person web app to let me visualize my data in a reasonable way and in a relatively small number of lines of code—it did great.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s