How to plot a matrix with ggplot? As gglot requires data as dataframes in long format, we have to reshape the matrix. In the example below, we calculate the mandelbrot set as a two dimensional matrix, reshape it via the melt function from the reshape package and plot it with gglot.
Preparation - load packages library(parallel) library(ggplot2) library(reshape2) The mandelbrot set The mandelbrot set is created by applying a specific function \(z^2+z\) iteratively on each point \(z=x+yi\) of the complex plane and record the number of iterations until the value exceeds a limit.