Die Python-Datenvisualisierung im Jahr 2026 reicht von schnellen explorativen Diagrammen bis hin zu publikationsreifen Zahlen und interaktiven Dashboards. Matplotlib, Seaborn, Plotly und Altair haben jeweils ihre Stärken. Dieser Leitfaden zeigt Ihnen, wann Sie die einzelnen Produkte verwenden und wie Sie schnell professionelle Ergebnisse erzielen.
📋 Table of Contents
Der Visualisierungsstapel
- Matplotlib— Stiftung, volle Kontrolle, Veröffentlichungszahlen
- Seaborn– statistische Diagramme, schöne Standardeinstellungen, Pandas-Integration
- Plotly— interaktive Diagramme für Dashboards und Web-Apps
- Altair— Deklarative Grammatik, hervorragend für explorative Analysen
- Dash/Streamlit— vollständige interaktive Dashboards in Python
Matplotlib: Stiftung
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
import numpy as np
# Figure and axes
fig, ax = plt.subplots(figsize=(10, 6))
# Line plot
x = np.linspace(0, 10, 200)
ax.plot(x, np.sin(x), label='sin(x)', linewidth=2, color='#0066CC')
ax.plot(x, np.cos(x), label='cos(x)', linewidth=2, color='#FF6600', linestyle='--')
# Styling
ax.set_title('Trigonometric Functions', fontsize=16, fontweight='bold', pad=15)
ax.set_xlabel('x', fontsize=12)
ax.set_ylabel('f(x)', fontsize=12)
ax.legend(fontsize=11)
ax.grid(True, alpha=0.3)
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
plt.tight_layout()
plt.savefig('trig.png', dpi=300, bbox_inches='tight')
plt.show()
# Subplots
fig, axes = plt.subplots(2, 2, figsize=(12, 8))
fig.suptitle('Multiple Plots', fontsize=16, fontweight='bold')
axes[0,0].hist(np.random.normal(0, 1, 1000), bins=30, color='steelblue', edgecolor='white')
axes[0,0].set_title('Normal Distribution')
axes[0,1].scatter(np.random.rand(50), np.random.rand(50), alpha=0.6, s=80)
axes[0,1].set_title('Scatter Plot')
x = ['A', 'B', 'C', 'D', 'E']
y = [23, 45, 12, 67, 34]
axes[1,0].bar(x, y, color=['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEAA7'])
axes[1,0].set_title('Bar Chart')
axes[1,1].boxplot([np.random.normal(0, std, 100) for std in [1, 2, 3]])
axes[1,1].set_title('Box Plot')
plt.tight_layout()
plt.show()
Seaborn: Statistische Visualisierung
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
# Load sample dataset
tips = sns.load_dataset('tips')
# Set theme
sns.set_theme(style='whitegrid', palette='muted', font_scale=1.2)
# Distribution plots
fig, axes = plt.subplots(1, 3, figsize=(15, 5))
# Histogram + KDE
sns.histplot(tips['total_bill'], kde=True, ax=axes[0], color='steelblue')
axes[0].set_title('Total Bill Distribution')
# Box plot by category
sns.boxplot(data=tips, x='day', y='total_bill', hue='sex', ax=axes[1])
axes[1].set_title('Bills by Day and Gender')
# Violin plot
sns.violinplot(data=tips, x='time', y='tip', hue='smoker',
split=True, inner='quart', ax=axes[2])
axes[2].set_title('Tips Distribution')
plt.tight_layout()
plt.show()
# Correlation heatmap
corr = tips.select_dtypes(include='number').corr()
plt.figure(figsize=(8, 6))
sns.heatmap(corr, annot=True, fmt='.2f', cmap='coolwarm',
center=0, square=True, linewidths=0.5)
plt.title('Correlation Matrix')
plt.show()
# Pair plot
sns.pairplot(tips, hue='sex', plot_kws={'alpha': 0.6})
plt.suptitle('Pair Plot', y=1.02)
plt.show()
# FacetGrid — multiple plots by category
g = sns.FacetGrid(tips, col='time', row='smoker', height=4)
g.map_dataframe(sns.scatterplot, x='total_bill', y='tip', alpha=0.6)
g.add_legend()
g.set_titles(col_template='{col_name}', row_template='{row_name}')
plt.show()
Plotly: Interaktive Diagramme
import plotly.express as px
import plotly.graph_objects as go
import pandas as pd
# Simple line chart
df = px.data.gapminder().query("continent == 'Asia'")
fig = px.line(df, x='year', y='lifeExp', color='country',
title='Life Expectancy in Asia',
labels={'lifeExp': 'Life Expectancy', 'year': 'Year'})
fig.update_layout(
plot_bgcolor='white',
paper_bgcolor='white',
font_family='Inter',
showlegend=True,
)
fig.show() # opens in browser
# Animated scatter plot
df = px.data.gapminder()
fig = px.scatter(df, x='gdpPercap', y='lifeExp',
animation_frame='year',
animation_group='country',
size='pop', color='continent',
hover_name='country',
log_x=True,
size_max=55,
range_x=[100, 100000],
range_y=[25, 90],
title='World Health and Wealth (1952-2007)')
fig.show()
# Custom chart with graph_objects
fig = go.Figure()
x = ['Q1', 'Q2', 'Q3', 'Q4']
fig.add_trace(go.Bar(name='2025', x=x, y=[23, 45, 56, 78], marker_color='#4C72B0'))
fig.add_trace(go.Bar(name='2026', x=x, y=[34, 52, 61, 89], marker_color='#DD8452'))
fig.add_trace(go.Scatter(name='Target', x=x, y=[30, 50, 65, 85],
mode='lines+markers', line=dict(color='red', dash='dash')))
fig.update_layout(
title='Quarterly Revenue 2025 vs 2026',
xaxis_title='Quarter',
yaxis_title='Revenue ($M)',
barmode='group',
hovermode='x unified'
)
fig.show()
# Export to HTML
fig.write_html('chart.html')
# Export static image (requires kaleido)
fig.write_image('chart.png', width=1200, height=600, scale=2)
Streamlit: Sofortige Dashboards
pip install streamlit plotly pandas
# dashboard.py
import streamlit as st
import plotly.express as px
import pandas as pd
st.set_page_config(page_title='Sales Dashboard', layout='wide')
st.title('Sales Analytics Dashboard')
# Sidebar filters
with st.sidebar:
st.header('Filters')
year = st.selectbox('Year', [2024, 2025, 2026])
region = st.multiselect('Region', ['North', 'South', 'East', 'West'],
default=['North', 'South'])
# KPI metrics
col1, col2, col3, col4 = st.columns(4)
col1.metric('Total Revenue', '$2.4M', '+12%')
col2.metric('Orders', '1,847', '+8%')
col3.metric('Avg Order Value', '$1,299', '+4%')
col4.metric('Satisfaction', '4.7/5', '+0.2')
# Charts in two columns
c1, c2 = st.columns(2)
with c1:
fig = px.line(get_monthly_data(year), x='month', y='revenue',
title='Monthly Revenue')
st.plotly_chart(fig, use_container_width=True)
with c2:
fig = px.pie(get_regional_data(region), values='revenue',
names='region', title='Revenue by Region')
st.plotly_chart(fig, use_container_width=True)
# Data table
st.subheader('Recent Orders')
df = get_orders(year, region)
st.dataframe(df, use_container_width=True)
# Run: streamlit run dashboard.py
Das richtige Werkzeug auswählen
| Aufgabe | Bestes Werkzeug |
|---|---|
| Veröffentlichungszahlen | Matplotlib |
| Statistische Analyse | Seaborn |
| Interaktive Webdiagramme | Plotly |
| Schnelle Dashboards | Streamlit |
| Grammatik der Grafik | Altair |
| Produktions-Dashboards | Bindestrich |
Die Python-Visualisierung im Jahr 2026 war noch nie so leistungsstark. Verwenden Sie Seaborn für explorative Analysen, Plotly für interaktive Berichte und Matplotlib für Zahlen in Veröffentlichungsqualität. Streamlit verwandelt jede Analyse in wenigen Minuten in ein gemeinsam nutzbares Dashboard.
🔗 Share this article
✍️ Leave a Comment