从Gnuplot数据文件中的列制作X轴抽动 [英] Making x-axis tics from column in data file in Gnuplot

查看:142
本文介绍了从Gnuplot数据文件中的列制作X轴抽动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下格式的数据文件.

I have a data file in the following format.

/foo.jsp 1234
/bar.jsp 6653
/foobar.jsp 9986
/bar.jsp 2221
/foo.jsp 5643

我想在Gnuplot中绘制此文件,其中从第一列获取x轴上的tic,从第二列获取y轴上的值.为了说明这一点,我希望图表看起来像这样:

I want to plot this file in Gnuplot where the tics on the x axis is taken from the first column and the values on the y axis from the second column. To illustrate I would like the chart to look something like this:

10000    x           x
5000     x           x          x
0      /foo.jsp /bar.jsp /foobar.jsp

x是图表中的点.

我设法做到的最好的是:

The best I have managed to do is:

plot "datafile.dat" using 2:xticlabel(1) with points

但是,该命令对第一列中的每个值重复tic(即,我在x轴上获得了两个/foo.jsp tic).我希望第一列中的每个唯一字符串都有一个唯一的tic.

However, that command repeats the tics for each value in the first column (i.e. I get two /foo.jsp tics on the x axis). I would like there to be one unique tic for each unique string in the first column.

推荐答案

我认为您应该在列中仅包含x数,例如foo.jsp = 1,bar.jsp = 2等,并假设您将其放入在第一列中.

I think you should include a column with just the x number, say foo.jsp=1 , bar.jsp=2, etc. and suppose you put this in the first column.

因此您的数据文件将如下所示:

So your datafile would look like:

1 foo.jsp 1234
2 bar.jsp 6653
3 foobar.jsp 9986
2 bar.jsp 2221
1 foo.jsp 5643

1 foo.jsp 1234
2 bar.jsp 6653
3 foobar.jsp 9986
2 bar.jsp 2221
1 foo.jsp 5643

然后使用:

plot "datafile.dat" using 1:3:xtic(2) with points

这篇关于从Gnuplot数据文件中的列制作X轴抽动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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