Python Data Visualization Tutorial: Pandas, Matplotlib, Seaborn, Bokeh, Folium and More
This tutorial walks through using Python's major data‑visualisation libraries—including pandas, matplotlib, seaborn, bokeh, altair and folium—to explore AI‑related popularity datasets, demonstrating basic plots, styling, interactive charts, map visualisation, and guidance on choosing the right tool for a project.
In this guide we examine several Python libraries for data visualisation using two AI‑related datasets (temporal.csv and mapa.csv) that contain popularity scores for terms such as data science, machine learning and deep learning.
Pandas is introduced for quick data inspection with import pandas as pd df = pd.read_csv('temporal.csv') df.head(10) # view first 10 rows . Descriptive statistics ( df.describe() ) and data types ( df.info() ) are shown, followed by options to increase display limits ( pd.set_option('display.max_rows', 500) pd.set_option('display.max_columns', 500) pd.set_option('display.width', 1000) ). Styling examples use df.head().style.format(format_dict) with currency, date and percentage formats, highlighting max/min values, background gradients, and bar charts.
A profiling report is generated with from pandas_profiling import ProfileReport prof = ProfileReport(df) prof.to_file(output_file='report.html') , producing an interactive HTML summary of the dataset.
Matplotlib is demonstrated for basic line plots, multiple series, legends, titles and grid lines. Example code: import matplotlib.pyplot as plt plt.plot(df['Mes'], df['data science'], label='data science') plt.xlabel('Date') plt.ylabel('Popularity') plt.title('Popularity of AI terms by date') plt.grid(True) plt.legend() plt.show() . Subplots, scatter plots, bar charts, histograms, text annotations and custom line styles are also covered.
Seaborn builds on Matplotlib to produce more sophisticated visuals with less code. Example: import seaborn as sns sns.set() sns.scatterplot(x='Mes', y='data science', data=df) . Pair plots, heatmaps, and categorical violin plots are illustrated.
Bokeh creates interactive web‑ready charts. Example setup: from bokeh.plotting import figure, output_file, save output_file('data_science_popularity.html') p = figure(title='data science', x_axis_label='Mes', y_axis_label='data science') p.line(df['Mes'], df['data science'], legend='popularity', line_width=2) save(p) . Multiple linked plots are combined using gridplot .
Altair is mentioned briefly as an additional option for specialized visualisations.
Folium enables geographic visualisation. A simple map is created with import folium m1 = folium.Map(location=[41.38, 2.17], tiles='openstreetmap', zoom_start=18) m1.save('map1.html') . Markers, bubble maps, and colour‑coded circles based on popularity values are added, using geocoding via geopandas.tools.geocode to obtain latitude and longitude.
The article concludes with advice on selecting a visualisation library: start with pandas for quick inspection, use Matplotlib for basic static plots, and move to Seaborn, Bokeh, Altair, or Folium for more advanced or interactive visualisations.
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.