Hello,
As shown in the MWE below, I have a data frame with three variables in long form and would like to plot it as a contour plot. There are two issues. First, the variables x and y span a triangular area rather than a rectangular area. Second, the function contour requires x and y to be vectors and z to be a matrix. Unfortunately, contour does not handle data in long form.
What is the best way to handle these issues?
using DataFrames
using Plots
df = DataFrame(x = Float64[], y = Float64[], z = Float64[])
vals = .01:.01:.99
for x ∈ vals, y ∈ vals
if x + y ≤ 1
push!(df, [x y x * y])
end
end