I’m plotting the surface of a function (the objective function of an optimization problem) with this code:
using GLMakie let # range x = LinRange(-2, 0.5, 51) y = LinRange(-2, 2, 51) # objective function z = 100 .* (y' .- x .^ 2) .^ 2 .+ (1 .- x) .^ 2 zmin, zmax = minimum(z), maximum(z) cmap = :greens fig = Figure(resolution = (900,900)) ax = Axis3(fig, perspectiveness = 0.5, elevation = π/9, zgridcolor = :grey, ygridcolor = :grey, xgridcolor = :grey) surface!(ax, x, y, z, colormap = cmap, colorrange = (zmin, zmax)) fig[1,1] = ax fig end
I’d like to portray the nonlinear constraints of the problem as well, for example:
x*y >= 1
x + y^2 >= 0
by e.g. displaying the infeasible points with a different color (throwing them out altogether wouldn’t help a lot for the visualization).
I don’t know if Makie supports that natively, or if I need to filter the LinRanges and display 2 surfaces. Can you help me out?