在贝塞尔曲线之间绘制垂直线 [英] drawing vertical lines in between bezier curves

查看:168
本文介绍了在贝塞尔曲线之间绘制垂直线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据文件中得到了x和y值以绘制贝塞尔曲线.每对(x,y)表示贝塞尔曲线.现在,我需要分离绘制垂直线(最好是虚线)的线段.程序应该在每个(x,y)处,以便多个贝塞尔曲线分开并可以进行分析.输入文件如下:

I have got x and y values in a data file to plot bezier curves. Each (x, y) pair denotes a bezier curve. Now I need to separate the segments drawing vertical lines (dotted lines preferably). The segements should be at each (x, y) so that the multiple bezier curves are separated and can be analysized. The input file is below :

0.07     0.543022222222 

0.06     0.694821399177 

0.08     0.734375 

0.12     0.743377777778 

0.11     0.795822222222 

0.09     0.772946197226 

0.14     0.798727048915 

0.05     0.6118208 

0.06     0.517422222222   

gnuplot的脚本是:

The script for gnuplot is:

set term x11 persist

set title "Animation curves"

set xlabel "Time (secs.)"

set ylabel "Parameter"

plot "curve.dat" using 1:2 notitle smooth csplines

如何实现?谢谢你.

推荐答案

您可以使用矢量绘制这些分隔线.以下脚本可以完成这项工作:

You could use vectors to draw those separation lines. The following script should do the job:

set key off
set style line 2 lt 0 lc 1 lw 2
plot [0.04:0.15] "Data.csv" u 1:2 smooth csplines ls 1, "" u 1:($2-0.1):(0):(0.2) w vectors nohead ls 2

  • set key off:使notitle关键字对于所有绘图都是多余的
  • set style line 2 lt 0 lc 1 lw 2:描述分隔线的外观.在这种情况下:

    • set key off: Makes the notitle keyword redundant for all plots
    • set style line 2 lt 0 lc 1 lw 2: Discribes how the separation lines should look like. In this case:

      • lt 0:虚线
      • lc 1:红色
      • lw 2线宽为2
      • lt 0: dashed
      • lc 1: red
      • lw 2 line width of 2

      "" u 1:($2-0.1):(0):(0.2) w vectors nohead ls 2:实际绘制分隔线:

      • ""使用以前使用的数据文件
      • u 1:($2-0.1):(0):(0.2):在数据文件的位置(x, y - 0.2)(x, y + 0.2)之间绘制矢量.
      • w vectors nohead:使用向量,让它们没有头.
      • ls 2:使用先前定义的线条样式2.
      • "" use the previously used data file
      • u 1:($2-0.1):(0):(0.2): Plot the vector between the positions (x, y - 0.2) and (x, y + 0.2) of the data file.
      • w vectors nohead: Use vectors and let them have no head.
      • ls 2: Use the previously defined line style 2.

      您可能会遇到的问题是,在数据文件中的位置0.06处定义了两个值,这使gnuplot取这两个值的平均值.这就是为什么位置x=0.06处的分隔线比其他位置长的原因,如下图所示:

      A problem you might have, is that in your data file there are at position 0.06 two values defined, which let gnuplot take the mean of those two values. This is why the separation line at position x=0.06 is longer than at other positions, as you can see in the following graph:

      这篇关于在贝塞尔曲线之间绘制垂直线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆