[英]Plotting Algebraic Curves in Julia
I'm looking to visualize some algebraic curves in Julia
我希望在
Julia
可视化一些代数曲线
I have the polynomials:我有多项式:
f1=(x^4+y^4-1)(x^2+y^2-2)+x^5y f1=(x^4+y^4-1)(x^2+y^2-2)+x^5y
f2 = x^2+2xy^2-2y^2-1/2 f2 = x^2+2xy^2-2y^2-1/2
and I would like to plot V(f1) and V(f2) so I can see their common intersections.我想绘制 V(f1) 和 V(f2) 以便我可以看到它们的共同交叉点。 I have tried using contour plot in
Gadfly.jl
but it seems to only allow me to plot one curve at a time.我曾尝试在
Gadfly.jl
使用等高线图,但它似乎一次只允许我绘制一条曲线。 Is there a way to plot both curves in Gadfly.jl
or doing it in another Julia
package?有没有办法在
Gadfly.jl
或另一个Julia
包中绘制两条曲线?
Gadfly is using a handy composite item: Layers
Gadfly 正在使用一个方便的复合项目:
Layers
https://gadflyjl.org/stable/man/compositing/#Layers https://gadflyjl.org/stable/man/compositing/#Layers
These are freely accessible through the plot as plot_name.layers
and can be manually appended ( eg using append!(p.layers, new_layer)
).这些可以通过
plot_name.layers
自由访问,并且可以手动附加(例如使用append!(p.layers, new_layer)
)。 A personal favorite is building both layers prior to calling plot()
and implementing any necessary figure labels within the plot()
function:个人最喜欢的是在调用
plot()
之前构建两个层并在plot()
函数中实现任何必要的图形标签:
using Gadfly
pol_one = layer(z=(x,y) -> (x^4 + y^4 - 1) * (x^2+y^2-2) + x^5 * y,
xmin=[-2], xmax=[2], ymin=[-2], ymax=[2],
Geom.contour(levels=[0;]))
pol_two = layer(z=(x,y) -> x^2 + 2x*y^2 - 2y^2 - 1/2,
xmin=[-2], xmax=[2], ymin=[-2], ymax=[2],
Geom.contour(levels=[0;]))
plot(p_layer, q_layer, Guide.xlabel("x"), Guide.ylabel("y"))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.