【问题标题】:Using gnuplot, how can I plot sin(x) in the x-z plane and sin(x) in the x-y plane, both at the same time?使用 gnuplot,如何同时在 x-z 平面中绘制 sin(x) 和 x-y 平面中的 sin(x)?
【发布时间】:2017-02-19 10:20:42
【问题描述】:

使用 gnuplot,如何同时在 x-z 平面上绘制 sin(x) 和在 x-y 平面上绘制 sin(x)?我猜我需要使用 set parametric 命令和 splot 命令,但我似乎无法解决剩下的问题!有谁知道如何做到这一点?我正在尝试生成一个演示电磁波性质的图。谢谢。

【问题讨论】:

    标签: gnuplot


    【解决方案1】:

    是的,参数模式是可能的。例如,splot u,0,sin(u), u,sin(u),0 将绘制两条 (!) 参数曲线 u,0,sin(u)u,sin(u),0。变量u 是参数虚拟变量,对于简单的正弦函数,我们只需要其中一个,即使在 3d 模式下也是如此。

    使用以下设置可能看起来更好一些,但这当然是我的偏见,远未完成,取决于您的需求:

    set terminal pngcairo
    set output "emfield.png"                                           
    set yrange [-2:2]                           
    set zrange [-2:2]                           
    
    set parametric 
    umax = 6*pi
    set urange [0:umax]                         
    
    unset border
    unset xtics
    unset ytics
    unset ztics
    
    # Set zeroaxes
    set xyplane at 0 
    set arrow from 0,0,0 to (umax*1.1),0,0 size screen 0.020,15,60 filled
    set arrow from 0,1,0 to 0,-1,0 size screen 0.020,15,60 filled
    set arrow from 0,0,-1.4 to 0,0,1.4 size screen 0.020,15,60 filled   
    
    splot u,0,sin(u) lc 6, u,sin(u),0 lc 7
    

    结果如下所示:

    【讨论】:

    • 优秀。谢谢你。正是我想要的。你说参数模式是一种可能性——还有其他的可能性或方法来实现这个解决方案吗?哦,我同意你的偏见;加上额外的设置,它看起来确实更好!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-02-26
    • 1970-01-01
    • 2020-02-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多