An Old Birthday Gift

This is an old birthday gift for a special person. It was the first time I tried to plot something using python, and I wasn’t very familiar with matplotlib, so I used the turtle library. import turtleimport timedef auguri(): colors = [‘blue’, ‘red’, ‘green’, ‘yellow’, ‘orange’, ‘purple’] turtle.pensize(5) turtle.bgcolor(‘black’) turtle.speed(1000) for x in range(360): turtle.pencolor(colors[x […]

Plotting 3D Lines

In Python as you know there’s the option of plotting 3D graphs, so why not fully exploiting such possibilities? In this example I will show a sort of an irregular spiral figure. import matplotlib as mplimport numpy as npimport matplotlib.pyplot as pltmpl.rcParams[‘legend.fontsize’] = 10fig = plt.figure()ax = fig.gca(projection=’3d’)theta = np.linspace(-4 * np.pi, 4 * np.pi, […]

Plotting Epicycloids

An epicycloid is the figure that a fixed point of a circle draws when the circle rotates on the circumference of another one. How to plot such things in Python? There is a trick: such figures depend on the ratio of the still circle’s and the rotating circle’s radius. Let’s say we have an integer […]

Happy Birthday Mom

I Made this nice plot for my mother’s birthday (which is today, 4th December) and I thought it would be nice to share it. import numpy as npimport matplotlib.pyplot as pltdef heart_plotter(precision): t = np.linspace(0, 60, precision) X = 1/100*(-t**2 + 40*t + 1200)*np.sin(t/90) Y = 1/100*(-t**2 + 40*t + 1200)*np.cos(t/60) Y_1 = 1/100*(-t**2 + […]

A Very Notorious Problem, But In 3D

I’ve already made an article on the 2D version of this problem, if you want to check it out before this one, you can visit https://www.mattiagiuri.com/2020/04/21/a-very-notorious-problem/. Now, the 3D version says: if you have 3 reals x, y, z chosen randomly between 0 and 1, what’s the probability that It’s important to notice that any […]

Scroll to top