Python Matplotlib Makes Conway’s Game of Life Come Alive

In this article, you’ll learn how to make this beautiful and interesting animation using only Python, NumPy, and Matplotlib — nothing else: 👇 But how does the Game of Life work – and what’s behind the classical visualization anyways? The Game of Life Conway’s Game of Life is a cellular automaton devised by the British … Read more

Python Plot Logarithmic Axes — Easy Bitcoin Example

Quick Answer: To print a logarithmic x-axis or y-axis (base 10) without a Matplotlib axis object use plt.xscale(‘log’) or plt.yscale(‘log’). To set different bases or switch back to a linear scale, use {“linear”, “log”, “symlog”, “logit”} or set the basex and basey arguments (e.g., plt.yscale(‘log’, basey=2) for log base 2). Next, we’ll have a look … Read more

Python Time Series Forecast – A Guided Example on Bitcoin Price Data

A Time Series is essentially a tabular data with the special feature of having a time index. The common forecast task is ‘knowing the past (and sometimes the present), predict the future’. This task, taken as a principle, reveals itself in several ways: in how to interpret your problem, in feature engineering, and in which … Read more

Plotting Vector Fields and Gradients for ANN Gradient Descent

👉 This is a follow-up article to Gradient Descent in Neural Nets – A Simple Guide to ANN Learning – Finxter, where a lightweight introduction to Gradient Descent is given. In this article, you will learn how to produce the graphs in that article, especially the vector fields! Data visualization is an enlightening task in … Read more

[Fixed] Matplotlib: TypeError: ‘AxesSubplot’ object is not subscriptable

Problem Formulation Say, you’re me 👱‍♂️ five minutes ago, and you want to create a Matplotlib plot using the following (genius) code snippet: If you run this code, instead of the desired plot, you get the following TypeError: ‘AxesSubplot’ object is not subscriptable: 💬 Question: How to resolve the TypeError: ‘AxesSubplot’ object is not subscriptable … Read more

Plot Circle in Pyplot

How to Plot a Circle in Python? You can easily plot a circle in Matplotlib’s Pyplot library by calling plt.gca() to “get the current axis”. Then call the axis.add_patch() function and pass a plt.Circle() object into it. For example, the one-liner plt.gca().add_patch(plt.Circle((0.5, 0.5), 0.2, color=’lightblue’)) adds a lightblue circle to the plot at position x=0.5, … Read more

How to Customize Gridlines (Location, Style, Width) in Python Matplotlib?

💡 Grid lines are horizontal and vertical lines that span the chart to represent axis divisions. They assist chart readers in determining what value is represented by an unlabeled data point. Grid lines provide essential indications to the observer, especially for big or sophisticated charts. In this article, you will learn how to customize the … Read more

Pandas DataFrame plot.pie() Method

Preparation Before any data manipulation can occur, four (4) new libraries will require installation. The Pandas library enables access to/from a DataFrame. The NumPy library supports multi-dimensional arrays and matrices in addition to a collection of mathematical functions. The Matplotlib library displays a visual graph of a plotted dataset. The Scipy library allows users to … Read more

Pandas DataFrame plot.hist() Method

Preparation Before any data manipulation can occur, four (4) new libraries will require installation. The Pandas library enables access to/from a DataFrame. The NumPy library supports multi-dimensional arrays and matrices in addition to a collection of mathematical functions. The Matplotlib library displays a visual graph of a plotted dataset. The Scipy library allows users to … Read more