
Explore creating graphs and geographic visualizations in healthcare and biological sciences using Python with Plotly, Pandas, and GeoDa. Learn to share code for reproducible analyses in scientific articles and presentations.
Learn to install and use Pandas, Plotly, and GeoDa in a Python open-source workflow, enabling data manipulation, publication-quality graphics, and geographic maps with Jupyter and VS Code.
Explore practical steps to install Python and Visual Studio Code, set up a data visualization workspace, and build graphs with Plotly, pandas, and GeoDa using real-world health data.
Explore self-contained visualization topics you can tackle independently, starting with data selection and preparation and progressing to complex graphics, with brief tips on dataset handling for python health data visualization.
Explore the tools behind health data visualizations in Python, including Visual Studio Code, Jupyter, and libraries Plotly, Seaborn, and Pandas, with step-by-step setup for a reproducible workflow.
Install Python and Visual Studio Code to start coding for health data visualization, download from the official sites, and set up a comfortable environment to write Python.
Set up VS Code for Python data work by creating a project folder, installing the Python extension, and adding Jupyter, Data Wrangler, and Rainbow CSV to run notebooks.
Set up a Jupyter notebook in Visual Studio Code and verify Python works by running a simple print('Hello world'), then dive into creating your first Plotly chart.
Create your first Plotly chart from scratch while learning to install and troubleshoot essential packages. See how pandas supports data handling as you fix missing modules and restart the environment.
Explore an interactive bar chart in Plotly, hover to reveal detailed info with x as nation and y as count, using px.data.medals_long() to test plotting in Jupyter on VS Code.
learn how to manage imports in Jupyter notebooks when using Plotly with Python, by separating imports into the first code cell and re-running them after restart to avoid name errors.
Install GeoDa, a free open-source tool for spatial data science, to visualize distributions by departments, cartograms, boxplots, and a 3D chart of lung cancer cases in this course.
Create a new Jupyter notebook in VS Code to build a sunburst chart using pandas, plotly.express, and plotly.io, including renderer setup and data exploration.
Explore a COVID-19 comorbidity dataset sourced from press reports, analyzed in a Jupyter notebook using a sunburst chart in Data Wrangler to drill into multiple comorbidity levels.
Explore how to visualize comorbidity patterns using sunburst charts by inspecting the dataset in Data Wrangler, analyzing the distribution of comorbidities, and interpreting hypertension and diabetes among deaths.
Explore higher multimorbidity in SARS-CoV-2 by adding Comorbilidad_3 and Comorbilidad_4 to a sunburst visualization that reveals three or four additional diseases and supports interactive, hierarchical data insights.
Set up a new Jupyter notebook in VS Code, import pandas and plotly libraries to manage data and create 3d charts, preparing for the first visualization.
Import and inspect the health dataset in Jupyter, noting city, day, temperature, and onset-to-diagnosis days; render a cube-like 3D visualization in Visual Studio Code.
Select data points for the 3d chart by setting up a Jupyter notebook in VS Code, importing pandas and plotly, and using plotly express and plotly io to visualize datasets.
Install and configure pandas, Plotly, and related tools to render 3D charts in Jupyter, then enable figure display with fig.show() and explore interactive filters by city.
Install and import the required packages to plot a Venn diagram and visualize intersections beyond three sets with membership diagrams using matplotlib instead of Plotly.
Convert categorical disease variables into binary indicators to reveal multimorbidity overlaps for a clear Venn diagram in Data Wrangler.
Create a three-set Venn diagram of cardiopathy, diabetes, and COPD to plot comorbidity intersections, then style outlines with a chosen palette for a cleaner, clearer health data visualization.
Explore how UpSet plots visualize multimorbidity, showing totals and intersections with bars and dots, offering a scalable alternative to Venn diagrams for multiple comorbidities.
You will need this additional code:
# Means and STD
distributions = [
{"mean":62.88, "std":18.2, "color":"#1f77b4","label":"Media 62.88"},
{"mean":68.39, "std":16.63, "color":"#ff7f0e","label":"Media 68.39"},
{"mean":71.56, "std":13.48, "color":"#2ca02c","label":"Media 71.56"},
{"mean":56.52, "std":14.24, "color":"#d67228","label":"Media 56.52"},
{"mean":72.75, "std":12.4, "color":"#9467bd","label":"Media 72.88"}
]
#Define x range
x= np.linspace(30, 100.500)
plt.figure(figsize=(10,6))
# Define normal distribution formula
def normal_pfd(x, mean, std):
return(1/(std*np.sqrt(2*np.pi)))*np.exp(-0.5*((x-mean)/std)**2)
Visualize health data by building histograms of time to death and age, filtering by comorbidity counts, using bins and kde curves to reveal distribution patterns.
Combine time-to-death distributions for comorbidity groups into a single plot, displaying mean, std, min, and max. Overlay normal distribution curves with a dashed mean line to visually compare group differences.
Install geopandas, load a geojson map, and prepare the dataset from Colombia's Datos Abiertos to analyze prostate cancer risk by department, filtering for males and age groups.
Merge geometry data with the totals DataFrame to build a choropleth map. Visualize population at risk by department using Plotly Express and gdf geometry.
Create a choropleth map of cancer data in GeoDa by merging annual cases for Colombia's 33 departments with the map and adjusting the legend and rates.
Create a cartogram in GeoDa by mapping the adjusted rate to color and total cases to circle size, revealing patterns across departments. The visualization combines two variables for storytelling.
You need this code for your Sankey Chart:
import pandas as pd
import plotly.graph_objects as go
df = pd.read_csv("DepartamentOfNotificationLeukaemias.csv")
df.columns = df.columns.str.strip().str.upper()
df['NUMBER OF PEOPLE'] = pd.to_numeric(df['NUMBER OF PEOPLE'], errors='coerce').fillna(0)
origins = df['HOUSEHOLD'].unique()
targets = df['NOTIFICATION FACILITY'].unique()
nodes = list(origins) + [t for t in targets if t not in origins]
node_dict = {node: idx for idx, node in enumerate(nodes)}
df['Source'] = df['HOUSEHOLD'].map(node_dict)
df['Target'] = df['NOTIFICATION FACILITY'].map(node_dict)
incoming = df.groupby('Target')['NUMBER OF PEOPLE'].sum()
outgoing = df.groupby('Source')['NUMBER OF PEOPLE'].sum()
node_colors = []
for node in nodes:
idx = node_dict[node]
in_flow = incoming.get(idx, 0)
out_flow = outgoing.get(idx, 0)
if in_flow > out_flow:
node_colors.append("rgba(214, 39, 40, 0.8)")
else:
node_colors.append("rgba(44, 160, 101, 0.8)")
x_positions = [0.01 if node in origins else 0.99 for node in nodes]
fig = go.Figure(data=[go.Sankey(
arrangement="snap",
node=dict(
pad=20,
thickness=20,
line=dict(color="black", width=0.5),
label=nodes,
color=node_colors,
x=x_positions
),
link=dict(
source=df['Source'],
target=df['Target'],
value=df['NUMBER OF PEOPLE'],
color="rgba(160,160,160,0.3)"
)
)])
fig.update_layout(
title_text="Notificación de casos de leucemia por departamento de origen y atención",
font=dict(size=12),
height=800,
margin=dict(l=30, r=30, t=60, b=30)
)
fig.show()
Build and customize a Sankey diagram in Plotly to visualize department inflows and outflows in a care pathway using CSV data. Map origin and destination names, and reveal flow patterns.
Data Visualization for Healthcare Professionals
Clear, impactful, and reproducible visualizations for health and life sciences.
In this course you’ll learn to create meaningful graphs tailored to healthcare, biological sciences, and related fields. We begin by setting up your environment step by step with Python, Jupyter Notebooks, and Visual Studio Code. You’ll work with two core libraries: Pandas for data preparation and Plotly for interactive, publication-quality visuals. We’ll also introduce GeoDa to build cartograms and other spatial analyses, giving you multiple approaches to explore geographic health data.
A basic familiarity with Python, R, Stata, or similar tools used in health data analysis is recommended so you can focus on visualization concepts while following the code.
Through hands-on exercises using real-world, anonymized datasets, you will:
Visualize cancer statistics, multimorbidity patterns, and epidemiologic trends.
Analyze COVID-19 data and health insurance population metrics.
Create clear, reproducible figures for articles, reports, and presentations.
Build geographic visualizations that reveal spatial relationships in health data.
We’ll emphasize reproducibility throughout: sharing the code behind your figures helps validate methods, fosters collaboration, and aligns with expectations of scientific publications.
By the end of the course, you’ll confidently prepare datasets, select effective visualization techniques, and turn complex health data into clear, actionable insights—ready for journals, stakeholders, or decision-makers.