See the wikipedia page on Logistic Map function

Create data for a range of the logistic map function

import java.util.TreeSet
import cats.implicits._
import spire.math.abs
import spire.implicits.DoubleAlgebra
import axle.math.logisticMap
import axle.{ orbit, applyK }
import axle.visualize._
import axle.awt._
val memo = collection.mutable.Map.empty[Double, TreeSet[Double]]
// memo: scala.collection.mutable.Map[Double,java.util.TreeSet[Double]] = Map()

def doubleClose(z: Double)(y: Double) = abs(z - y) < 1e-6
// doubleClose: (z: Double)(y: Double)Boolean

def f(λ: Double, maxX: Double, maxY: Double, minY: Double): Boolean = {
  val f = logisticMap(λ)
  val set = memo.get(λ).getOrElse {
    val set = new TreeSet[Double]()
    orbit(f, applyK(f, 0.3, 100000), doubleClose) foreach { set.add }
    memo += λ -> set
// f: (λ: Double, maxX: Double, maxY: Double, minY: Double)Boolean

Define a “value to color” function.

val v2c = (v: Boolean) => if (v) else Color.white
// v2c: Boolean => axle.visualize.Color = <function1>

Define a PixelatedColoredArea to show a range of Logistic Map.

val pca = PixelatedColoredArea(f, v2c, 4000, 4000, 2.9, 4d, 0d, 1d)
// pca: axle.visualize.PixelatedColoredArea[Double,Double,Boolean] = PixelatedColoredArea(<function4>,<function1>,4000,4000,2.9,4.0,0.0,1.0)

Create the PNG

png(pca, "logMap.png")

Logistic Map