如何绘制不同颜色的多个向量? [英] How to draw multiple vectors with different color?

查看:109
本文介绍了如何绘制不同颜色的多个向量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用gnuplot画线。
数据文件是:

 #X1 y1 x2 y2 colorNumber 
123 567 798 900 1
788 900 87 89 2
....

我创建了一个调色板

  set palette model RGB defined(1'violet',2'red',3'blue',4'yellow',5'green ',6'orange',7'cyan')

如何绘制每行的颜色?



我尝试followng,但无法正常工作。

 使用1:2:($ 3- $ 1)绘制'〜/ Desktop / pointcolor.txt':($ 4- $ 2):3使用矢量调色板nohead notitle 

这里是结果,问题是行颜色与我所定义的不匹配。



解决方案

您的数据文件共包含五列,第五列包含您想要的颜色编号。所以你需要使用1:2:($ 3- $ 1):'$ / $>

pre $ plot'〜/ Desktop / pointcolor.txt':($ 4 - $ 2):5与矢量调色板noheadleitle


I want to draw lines using gnuplot. data file is:

#X1 y1 x2 y2 colorNumber
123 567 798 900 1
788 900 87  89 2
....

I create a palette

set palette model RGB defined ( 1 'violet', 2 'red', 3 'blue', 4 'yellow', 5 'green', 6 'orange', 7 'cyan')

How can I draw each line with its color?

I try followng but it didn't work fine.

plot '~/Desktop/pointcolor.txt' using 1:2:($3-$1):($4-$2):3 with vectors palette nohead notitle

here is the result, the problem is line color didn't match with what I have deffined.

解决方案

You data file contains a total of five columns, the fifth one contains your desired color numbers. So you need

plot '~/Desktop/pointcolor.txt' using 1:2:($3-$1):($4-$2):5 with vectors palette nohead notitle

这篇关于如何绘制不同颜色的多个向量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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