如何在之前的绘图后面绘制图形(如何将一个绘图推到另一个绘图的背景)

huangapple go评论56阅读模式
英文:

Julia, how to plot behind previous plot (how to push a plot to the backgrown of another plot)

问题

lineplot2 出现在 lineplot 的顶部,也就是红色的点出现在蓝线的上方,在某些点上会遮挡蓝线。
如何将红点“推送”到它们出现在蓝线的后面?

英文:

I'm plottiong a sin and a cos function with the following code:

using GLMakie
x = range(0, 10, length=100)
figure, axis, lineplot = lines(x, sin)
lineplot2 = scatter!(x, cos, color = :red)
figure

lineplot2 appears on top of lineplot, that is, the red dots appear on top of the blue line, effectively masking the blue line at some points.
How do I "push" the red dots so that they appear behind the blue line?

答案1

得分: 1

使用 translate! 函数找到如何执行此操作。

using GLMakie
x = range(0, 10, length=100)
figure, axis, lineplot = lines(x, sin)
lineplot2 = scatter!(x, cos, color = :red)
translate!(lineplot2, 0, 0, -1)
figure
英文:

found how to do it by using translate!

using GLMakie
x = range(0, 10, length=100)
figure, axis, lineplot = lines(x, sin)
lineplot2 = scatter!(x, cos, color = :red)
translate!(lineplot2, 0, 0, -1)
figure

huangapple
  • 本文由 发表于 2023年2月24日 01:03:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/75548040.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定