Towards Reverse Engineering Matplotlib Code From Images

I tried a few helpful applications of Google Bards Image Recognition capabilities for coders. I don’t know about you but I often see beautiful plots (e.g., in research papers or data science reports) and wonder how I could recreate them. Well, Google Bard to the rescue! ✅ Reverse Engineer Exponential Plot in 2D First, let’s … Read more

(Fix) ValueError: Argument Z must be 2-dimensional

Problem Formulation The output when running this code is as follows Warning (from warnings module): File “C:\Users\xcent\Desktop\code.py”, line 10 ax = fig.gca(projection=’3d’) MatplotlibDeprecationWarning: Calling gca() with keyword arguments was deprecated in Matplotlib 3.4. Starting two minor releases later, gca() will take no keyword arguments. The gca() function should only be used to get the current … Read more

How Do I Make a 3D Waterfall Plot with Colored Heights in Python?

To generate a 3D waterfall plot with colored heights create a 2D sine wave using the NumPy meshgrid() function, then apply a colormap to the heights using Matplotlib’s Normalize function. The plot_surface() function generates the 3D plot, while the color gradient is added using a ScalarMappable object. Here’s a code example for copy and paste: … Read more

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