Gnuplot X tic标签重叠 [英] Gnuplot x tic labels overlap

查看:202
本文介绍了Gnuplot X tic标签重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从数据文件中绘制gnuplot图表,格式如下:

I am drawing a gnuplot chart from datafile with such format:

01 value_1_1 value_2_1
02 value_1_1 value_2_1
...
01 value_1_n value_2_n

使用该命令:

plot "action.dat" using 2:xtic(1) with boxes ls 1 title "First title",\
     "action.dat" using 3:xtic(1) with boxes ls 2 title "Second title";

X tic标签从第一列加载。当端子太小时,标签开始重叠。如果x tic标签与先前的标签重叠,该如何隐藏?或者,至少,如何只绘制第n个标签?

X tic labels are loaded from the first column. When terminal is too small, labels start to overlap. How can I hide x tic label if it overlaps previous label? Or, at least, how can I draw only n-th label?

我试图做类似的事情

set xtics 10 rotate by -90

但失败。

推荐答案

要(有效地)绘制第n个标签,您可以使用类似以下内容的方法:

To (effectively) plot every nth label, you can use something like:

plot "action.dat" using 2:xtic(int($0)%3==1 ? strcol(1):'') with boxes ls 1 title "First title"

这实际上将绘制每一个标签,但不是第n个标签的标签将被绘制为空字符串...

This will actually plot every label, but the ones that aren't the n'th label will just be plotted as empty strings ...

这篇关于Gnuplot X tic标签重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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