You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some cases, it's useful to be able to overlay contour lines of two functions on the same plot. For example, if you're solving a system of equations
f(x, y) = 0
g(x, y) = 0
for points x, y, it can build insight to overlay contour lines for both f and g on the same plot.
I've tried this:
fig, ax, hc =contour(f; labels=true, labelcolor=:red) # f is a matrix of grid-values of one functioncontour!(ax, g; labels=true, labelcolor=:blue) # g likewise
but the outcome is clearly wrong: among other things, I see the f contour lines re-labeled in blue.
A partial work-around is to overlay two surface plots on the same Axis3, but one has to manage transparency etc. more carefully than for a contour plot.
For plot types, please add an image of how it should look like
From Numerical Recipes:
The text was updated successfully, but these errors were encountered:
could you show us some more code for your functions? please. The following works as in the reference image:
using GLMakie
f(x, y) =abs(sin(x)*sin(y))
g(x, y) =abs(cos(x)*cos(y))
x = y =-3:0.1:3
zf = [f(x, y) for x in x, y in y]
zg = [g(x, y) for x in x, y in y]
fig =Figure()
ax =Axis(fig[1,1])
contour!(ax, x, y, zf; labels=true, color=:black, linestyle=:dash, linewidth=2,
labelcolor=:red, levels = [0.5,1])
contour!(ax, x, y, zg; labels=true, color=:dodgerblue, linewidth=2,
labelcolor=:blue, levels = [0.5,1])
fig
Thanks! I don't have a record of my exact functions (they depended on a data set), but I'm guessing there must have been some degeneracy. I'll close this, with apologies for the noise.
Feature description
In some cases, it's useful to be able to overlay contour lines of two functions on the same plot. For example, if you're solving a system of equations
for points
x, y
, it can build insight to overlay contour lines for bothf
andg
on the same plot.I've tried this:
but the outcome is clearly wrong: among other things, I see the
f
contour lines re-labeled in blue.A partial work-around is to overlay two surface plots on the same
Axis3
, but one has to manage transparency etc. more carefully than for a contour plot.For plot types, please add an image of how it should look like
From Numerical Recipes:
The text was updated successfully, but these errors were encountered: