Python: Displaying data at specific times with Matplotlib

Python: Displaying data at specific times with Matplotlib

With this simple script, you can display simple data in a Python dictionary using a bar chart.

Installation process

To do this, you need to install Python and then the Matplotlib module.

For Python, go to the official Python.org website and install the latest version. Once that is complete, install the Matplotlib module in the command line or terminal, depending on which operating system you are using.

pip install matplotlib

Any necessary library files will then be downloaded and installed.

Using an editor

Next, open your favourite editor (not a normal word processor), whether it’s the brand-new Cursor editor, Visual Studio Code, PyCharm, or, for purists, the VIM editor, which can also be used on Linux. Several people have already written to me about this. It doesn’t matter which one you use.

The correct file extension is important

The only important thing is that the file extension is .py.

The source of the data from the script

My example shows the number of visits to my blog in September 2025. These figures were recorded using the WordPress plugin Statify.

In this script I have added the posibility to save the output in a webp format photo file. This file I present now below the script, what you see with the title „Bar chart“, „days“, „request“. The file has a size about 31 KB and it has a good quality. Of course you can increase the quality of the picture.

import pandas as pd
import matplotlib.pyplot as plt

data_mit_fehler = {"Days": ["01.09", "02.09","03.09","04.09","05.09", "06.09","07.09","08.09","09.09.","10.09","11.09","12.09","13.09","14.09","15.09","16.09","17.09","18.09","19.09","20.09","21.09","22.09","23.09","24.09","25.09","26.09","27.09","28.09","29.09","30.09"], 
"request":                   
[1152, 961, 2720, 1364, 1228, 1795, 1232, 2171, 2458, 1055, 2467, 3372, 4116, 2780, 4295, 6745, 7676, 5692, 1785, 5425, 5492, 3796, 4917, 3416, 2531, 1112, 7011, 3433, 2628, 1753]}

plt.figure(figsize=(20,6))
plt.bar(data_mit_fehler["Days"],data_mit_fehler["request"],color="skyblue")
plt.xlabel("Days")
plt.ylabel("request")
plt.title("Bar chart")
plt.savefig(f"daten.webp", dpi=150, facecolor='white', bbox_inches='tight', pil_kwargs={'quality': 85})
plt.show()

The data in a chart

Data output of the Python script.
Die Kommentare sind geschlossen.