Multiple Lines on Line Plot or Time Series with Matplotlib

Multiple Lines on Line Plot or Time Series Matplotlib

As a Python developer, I’ve worked extensively with data visualization. One of the most common tasks I encounter is plotting multiple lines on a single line plot or time series chart. This is especially useful when comparing trends across different datasets, like tracking sales performance across multiple states or monitoring temperature changes in various cities. … Read more >>

Matplotlib Plotting Multiple Lines in 3D

Matplotlib Plot Multiple Lines in 3D

When I started working with 3D data visualization in Python, I found plotting multiple lines in three dimensions a bit tricky. Matplotlib’s 3D plotting capabilities are powerful but can be intimidating without an easy guide. I’ve experimented with several approaches, and I want to share the ones that worked best for me. Whether you’re analyzing … Read more >>

Tkinter Date and Time Picker: tkcalendar, Spinbox and tkTimePicker

Tkinter date and time picker tutorial with tkcalendar, Spinbox, tkTimePicker and CustomTkinter

Tkinter has no built-in date or time picker. For dates, install tkcalendar and use DateEntry (an entry with a dropdown calendar) or Calendar (a calendar shown in the window). For times, use two ttk.Spinbox widgets for hours and minutes, or the tkTimePicker package for a spin or clock-style picker. This guide shows each one with … Read more >>

How to Add an Image to Python Turtle (GIF, PNG and Background)

Attach an image to Python Turtle: rocket image shapes rotated in eight directions

To attach an image to a Python Turtle, register the image as a shape with screen.register_shape(“rocket.gif”) and then call t.shape(“rocket.gif”). Up to Python 3.13 that shortcut only accepts GIF files; PNG works too, but through tkinter.PhotoImage (shown below), and Python 3.14 adds PNG to register_shape() directly. This guide also covers background images, resizing, making images … Read more >>

PyQt6 QTreeView Tutorial: Examples with Models, Files, Checkboxes and Search

PyQt6 QTreeView tutorial: file browser with QFileSystemModel and checkable tree

QTreeView shows hierarchical data (folders, categories, parent/child records) as an expandable tree. It displays a model: the quickest is QStandardItemModel, where you add QStandardItem rows under other items. This guide builds working PyQt6 tree views step by step: a basic tree, a tree from a nested dict, a file browser, checkboxes, search, a context menu, … Read more >>

scipy.stats.multivariate_normal: pdf, cdf, rvs and fit (With Examples)

scipy.stats.multivariate_normal tutorial: pdf, cdf, rvs, fit and marginal with tested examples

scipy.stats.multivariate_normal is SciPy’s multivariate normal (Gaussian) distribution. Give it a mean vector and a covariance matrix, then call pdf() for the density, cdf() for probabilities, rvs() for random samples and fit() to estimate the parameters from data. This guide explains each method with a complete, runnable example and checks the results against simulation. Every example … Read more >>

Draw a Flower in Python Turtle: 6 Flower Programs with Code

Draw a flower in Python Turtle: sunflower and colourful flower drawn with Turtle code

To draw a flower with Python Turtle, draw one petal with two arcs (circle(radius, angle) twice, turning 180 – angle after each), then repeat it in a loop, turning 360 / petals degrees between petals. This page explains that petal trick with a diagram and then gives six complete flower programs to copy: a simple … Read more >>

Matplotlib savefig() Saves a Blank Image? 7 Causes and Fixes

Matplotlib plt.savefig saves a blank image: save before plt.show() or use fig.savefig()

plt.savefig() saves a blank image when the figure it saves is no longer the one you drew on. The most common reason is calling it after plt.show(): when you close the plot window, Matplotlib closes the figure, and plt.savefig() then saves a brand-new empty one. The fix is to save first, or to keep the … Read more >>