AlanJones Coding, Data Science and Data Visualization


Build Data Visualization apps for the web using Streamlit, Plotly, Python and Flask.

See the articles/tutorials, below, and find the code for them on Github by following the links below.
You can find me on: Medium, Twitter as @MrAlanJones and LinkedIn.

ARTICLE
stlite: Serverless Streamlit— Run Your Apps in the Browser
stlite is a browser-based implementation of Streamlit that can run apps on a web page without having to deploy to a Streamlit server
ARTICLE
Altair: Using the Powerful Vega-Lite 'Grammar of Graphics
Using the Altair library for Python we can develop compelling data visualizations based on a grammar of graphics and implement them in Streamlit

Find the code here

NEWSLETTER
Data Visualization, Data Science and Python
Subscribe to my newsletter on Substack
ARTICLE
How to Use the Powerful New Assistants API for Data Analyst
OpenAI’s Assistants API lets us create AI assistants which leverage tools that can operate on user-provided data

Find the code here

ARTICLE
How to Create a Simple GIS Map with Plotly and Streamlit
Plotly map functions combined with Streamlit user interface components provide a way of creating GIS-style dashboards

Click here for a Demo

Find the code here

ARTICLE
Flapjax: Data Visualization on the Web with Plotly and Flask
Build a data visualisation web page with Plotly and Flask, and make it interactive with some UI components

Find the code here

ARTICLE
Data Visualization on the Web with Plotly and PyScript
Put your data visualisations on the web with HTML templates — no server-side code required

Find the code here

Downloadable eBook
Streamlitfrom Scratch

Streamlit is a framework for creating Data Science apps in Python.
Streamlit from Scratch is an ebook that will teach you how to get started with Streamlit.

ARTICLE
A New Plotly Component for Streamlit
Streamlit only supports two Plotly themes: the Streamlit theme, or the default Plotly theme. We present a Streamlit component that will you to display Plotly charts more flexibly.

Find the code here

ARTICLE
2023 was the Hottest Summer Ever
We look at how to visualize the hottest-ever recorded temperatures over the period of June through August 2023

Find the code here

ARTICLE
How to Build Waterfall Charts with Plotly Graph Objects
Plotly Express doesn't implement waterfall charts but we can create a helper function that utilises Plotly Graph Objects instead

Find the code here

ARTICLE
Streamlit and MongoDB: Storing Your Data in the Cloud
Deploying your Streamlit app to the Cloud means that any data that you create with that app disappears when the app terminates - unless you use third-party storage like the NoSQL database MongoDB

Find the code here

ARTICLE
Using Streamlit’s Chat Elements: the Doctor is in
We use Streamlit’s chat elements to reproduce the famous 1960s Rogerian-psychologist-bot ELIZA

Click here for a Demo

Find the code here

ARTICLE
Simple Surveys with Streamlit
Streamlit’s user interface components made constructing simple surveys easy. We create a simple survey with Streamlit, present it and show the results.

Find the code here

ARTICLE
Visualizing 'Brexit Regret' Data
A recent poll shows that more Britons favour rejoining the EU than those who still support Brexit. Let’s draw some graphs.

Click here for a Demo

Find the code here

ARTICLE
Build a Web App with Jupyter and Mercury
Mercury provides a simple way to transform Jupyter Notebooks into interactive web apps.

Click here for a Demo

Find the code here

ARTICLE
How to Publish Your Jupyter Notebook Apps with Mercury Cloud
Convert your Notebooks to web apps then publish them in the cloud.

Click here for a Demo

ARTICLE
ChatGPT Prompting for Coders: a Prototyping Approach
A suitable prompting technique can make the development of usable code with ChatGPT quite painless. Here we prototype a Streamlit app for tracking cryptocurrency.
ARTICLE
ChatGPT-like AI Could Replace the Equivalent of 300m Workers
A new Goldman Sachs report will be scary reading for some.
ARTICLE
How I used ChatGPT to Build a Streamlit Dashboard App
Using CO² emission data I created a dashboard app in Streamlit with ChatGPT and no coding
ARTICLE
Will ChatGPT Kill Open Source and Is It Even Legal?
Time and a lawsuit will tell but there is a large question mark over generative AI and its use of copyrighted material
ARTICLE
What’s new in PyScript in 2023
Since I last wrote about PyScrypt there have been two updates — versions 2022.09.1 and 2022.12.1 — and we no longer seem to be in alpha territory.
BOOK - sponsored content
The Art of Statistics: How to Learn from Data
In this 'important and comprehensive' guide to statistical thinking (New Yorker), discover how data literacy is changing the world and gives you a better understanding of life’s biggest problems. - I have used this book in various articles and found it to be invaluable.
ARTICLE
Data Analysis with ChatGPT and Jupyter Notebooks
The conversational way of generating code with ChatGPT works well with the cell structure of Jupyter Notebooks. There is a natural workflow when using ChatGPT with Jupyter Notebooks which makes generating a code for a Jupyter Notebook using ChatGPT surprisingly easy and satisfying.
EBOOK
Streamlit from Scratch
Find the tools you need and use them to create your first interactive web app in Python and Streamlit. Add media to your apps to help to communicate your ideas, produce text figures, tables and sophisticated charts from Pandas dataframes using Matplotlib, Plotly, Altair and other libraries. Finally, use the UI and layout features of Streamlit to create data dashboard apps.
ARTICLE
Streamlit Text Gets Colourful
Your Streamlit text no longer has to be boring. Version 1.16 lets you colour markdown text.
ARTICLE
Organize Your Data Science Projects with PPDAC - a Case Study
Define your problem, develop a plan, find the data, analyze the data and then communicate your conclusions - that's PPDAC

Find the code here

ARTICLE
CO2 Emissions Infographics in Python
How To Build a Data Infographics with Python and Matplotlib

Find the code here

BOOK - sponsored content
Storytelling with Data: A Data Visualization Guide for Business
Don't simply show your data—tell a story with it! Storytelling with Data teaches you the fundamentals of data visualization and how to communicate effectively with data. I use this excellent book in the series of articles '12 Essential Visualizations and How to Implement them.
ARTICLE
12 Essential Visualizations and How to Implement Them - part 1
We look at how to create the 12 most useful graphs and charts with Python, Matplotlib and Streamlit.

Find the code here

ARTICLE
12 Essential Visualizations and How to Implement Them - part 2
We look at how to create the 12 most useful graphs and charts with Python, Matplotlib and Streamlit.

Find the code here

ARTICLE
NASA Open APIs: The Astronomy Picture of the Day in Streamlit
Streamlit is not just for Data Science, you can create excellent general-purpose web sites, too. Here we use the NASA Open API and show how to keep your API key a secret.

Click here for a Demo

Find the code here

ARTICLE
How to Create a Grid Layout in Streamlit
We present a method to programmatically create a grid layout in Streamlit with a World population data demonstration app

Find the code here

ARTICLE
PyScript v. Flask: How to Create a Python App in the Browser or on a Server
PyScript lets you create web apps in Python without the need for a server. Flask is a Python web app framework for making server-based apps. We write the same simple app using both

Find the code here

DOWNLOADABLE BOOK
Plotting with Pandas: An Introduction to Data Visualization
If you are a budding Data Scientist or Data Journalist, being able to visualize your data gives you the ability to better understand it
ARTICLE
4 Ways to Create a Multi-Page Streamlit App
Streamlit may not have been designed for full blown web sites but it is fairly straightforward to create multiple pages in a single appt

Find the code here

ARTICLE
How to use Ploty with PyScript
PyScript doesn’t support Plotly directly but there is a simple way around it

Click here for a Demo

Find the code here

ARTICLE
Create an Interactive Web App with PyScript and Pandas
PyScript allows us to create a serverless web application with HTML and Python as the scripting language.

Click here for a Demo

Find the code here

ARTICLE
Visualizing Health Risk
The press can very easily get it wrong when dealing with health risk data. Data visualizations can help.

Find the code here

ARTICLE
How to Use Wikipedia as a Data Source
How to load information from Wikipedia into Pandas by finding the best team in the English Premier League

Find the code here

CODE HINT
Customizing Streamlit Columns
Streamlit has a limited layout model and this is normally an advantage as it allows the simple construction of sophisticated apps. But sometimes you want to modify the layout.

Click here for a Demo

Find the code here

ARTICLE
Plotly with Streamlit, Dash or Flask
Which is the best framework for your data science apps

Find the code here

ARTICLE
Mean, Median and Mode: What Are They and When Should You Use Them?
You probably remember Mean, Median, and Mode from high school stats classes but they are often misused. We look at how you should use them — with Python and Pandas examples.

Find the code here

ARTICLE
How to Share your Jupyter Notebook with Mercury or Voilà
Putting your Jupyter notebook on the web is reasonably easy with either Mercury or Voilà but which is easier - here's a brief comparison of the two technologies

Find the code here

ARTICLE
Publish Your Streamlit Apps in the Cloud
Share your Streamlit apps with these free tools: Streamlit Cloud, Github and VSCode
ARTICLE
SQL, Pandas or Both - Analysing the UK Electoral System
Pandas is great for analysing and plotting data but should you store your data in a database and select it with SQL. Let's take a look at some common operations using Pandas and SQL and see how they compare

Find the code here

ARTICLE
Data Scientists: Write your Medium Articles in Jupyter
Don’t waste time cutting and pasting and making screen shots of data tables, write everything as a Jupyter Notebook and upload to Medium
ARTICLE
Create a Web App from Your Jupyter Notebook with Mercury
You can published you Notebook as an interactive web app with or without the code

Find the code here

ARTICLE
How Not to Lie with Charts
You can use data visualization to inform, or misinform. We look at the things to avoid if you want to do the former and not the latter.
BOOK - sponsored content
How Charts Lie: Getting Smarter about Visual Information
A leading data visualization expert explores the negative―and positive―influences that charts have on our perception of truth. I used this book as the inspiration for 'How Not to Lie with Charts'
ARTICLE
Interactive Data Visualization with Julia and Pluto Notebooks
Pluto is an important development that allows you to easily interact with your data. We take a quick look at it using the Julia plotting package to easily create impressive graphs.
ARTICLE
How to Build a Gallery of Streamlit Apps as a Single Web App
Download a free template, pop in multiple Streamlit apps and you’ve got a multiple Streamlit apps on a single web page
ARTICLE
A Multi-page Interactive Dashboard with Streamlit and Plotly
https://towardsdatascience.com/a-multi-page-interactive-dashboard-with-streamlit-and-plotly-c3182443871a

Find the code here

ARTICLE
An Interactive Web Dashboard with Plotly and Flask
To create a truly interactive app with Dash you need to use callbacks. You can achieve the same thing with Plotly and Flask.
ARTICLE
Why I’m Using VSCode for Jupyter Notebooks
VSCode is a great Python editor and, as I accidentally discovered, good for Jupyter Notebooks, too
ARTICLE

Topical Plots: Global Warming Heatmaps
Which chart will get the message across best
ARTICLE
ggplot: Grammar of Graphics in Python with Plotnine
Do you wish that Python could emulate the superb visualizations that ggplot gives you in the R language? Well it can.
Plotnine is a powerful graphics library for great visualizations and based on ggplot
ARTICLE
Data Visualization with Julia and VSCode
With Julia and the free VSCode IDE, you can make impressive data visualizations with little programming knowledge.
ARTICLE
Earlier articles that have not yet made it to this web page yet can be found here
This page will be continually updated with both new and older articles
Downloadable eBook
Streamlitfrom Scratch

Streamlit is a framework for creating Data Science apps in Python.
Streamlit from Scratch is an ebook that will teach you how to get started with Streamlit.

Sponsored content
How Charts Work: Understand and explain data with confidence
From the Back Cover

How Charts Work brings the secrets of effective data visualisation in a way that will help you bring data alive. Charts, graphs and tables are essential devices in business, but all too often they present information poorly. This book will help you:

  • Feel confident understanding different types of charts, graphs and tables – and how to read them
  • Recognise the true story behind the data presented and what the information really shows
  • Know the principles and rules of how best to represent information so you can create your own information-driven (and beautiful) visuals
  • Design visuals that people engage with, understand and act upon
  • Sponsored content
    The Art of Statistics: How to Learn from Data
    Discover how data literacy is changing the world and gives you a better understanding of life's biggest problems. I have used this book in various articles and found it to be invaluable.
    Downloadable eBook
    Plotting with Pandas

    Plotting with Pandas: an Introduction to Data Visualization is an ebook that covers basic and statistical plots using Python and Pandas, line and bar charts, scatter plots, pie charts, histograms, box plots, etc.

    Sponsored content
    Storytelling with Data: A Data Visualization Guide for Business
    Don't simply show your data - tell a story with it! Storytelling with Data teaches you the fundamentals of data visualization and how to communicate effectively with data. I use this book in the series of articles '12 Essential Visualizations and How to Implement them.
    Sponsored content
    How Charts Lie: Getting Smarter about Visual Information
    A leading data visualization expert explores the negative - and positive - influences that charts have on our perception of truth. I used this book as the inspiration for 'How Not to Lie with Charts'.