Sitemap
Linking

Linking

Member-only story

Streamlit + Matplotlib: Visualization Dashboards

18 min readApr 21, 2025

--

Hello,

Press enter or click to view image in full size
Photo by Luke Chesser on Unsplash

Example 1: Simple Streamlit Dashboard with Matplotlib Plot

This example demonstrates how to integrate Matplotlib with Streamlit to create an interactive dashboard.

python
Copy code
import streamlit as st
import matplotlib.pyplot as plt
import numpy as np
# Set up the Streamlit app
st.title("Interactive Matplotlib Plot with Streamlit")
# Generate some data for plotting
x = np.linspace(0, 10, 100)
y = np.sin(x)
# Create a Matplotlib plot
fig, ax = plt.subplots()
ax.plot(x, y, label="Sine Wave")
ax.set_xlabel('X Axis')
ax.set_ylabel('Y Axis')
ax.set_title('Sine Wave')
ax.legend()
# Display the plot in Streamlit
st.pyplot(fig)

Example 2: Plotting Dynamic Data with Streamlit and Matplotlib

This example shows how you can modify the data in real-time using Streamlit widgets and update the plot interactively.

python
Copy code
import streamlit as st
import matplotlib.pyplot as plt
import numpy as np
# Streamlit widgets to control…

--

--