GNOUPUPT:如何增加我的图表的宽度 [英] gnuplot: How to increase the width of my graph

查看:26
本文介绍了GNOUPUPT:如何增加我的图表的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用‘gnplot’绘制带有以下点的折线图:

set style data linespoints
set xlabel "number"

set ylabel "Dollars"
set yrange [0:250]

如何增加图形的宽度,以便随着"x"的增加,我希望图形更像矩形而不是正方形?

我怎样才能增加"y轴"的间隔?现在,它只是在我的y轴上每50个位置画一个记号?

推荐答案

听起来您似乎希望根据要绘制的数据动态调整输出的大小。以下是执行此操作的脚本:

#!/usr/bin/env gnuplot

# don't make any output just yet
set terminal unknown

# plot the data file to get information on ranges
plot 'data.dat' title 'My Moneys'

# span of data in x and y
xspan = GPVAL_DATA_X_MAX - GPVAL_DATA_X_MIN
yspan = GPVAL_DATA_Y_MAX - GPVAL_DATA_Y_MIN

# define the values in x and y you want to be one 'equivalent:'
# that is, xequiv units in x and yequiv units in y will make a square plot
xequiv = 100 
yequiv = 250 

# aspect ratio of plot
ar = yspan/xspan * xequiv/yequiv

# dimension of plot in x and y (pixels)
# for constant height make ydim constant
ydim = 200 
xdim = 200/ar

# set the y tic interval
set ytics 100 

# set the x and y ranges
set xrange [GPVAL_DATA_X_MIN:GPVAL_DATA_X_MAX]
set yrange [GPVAL_DATA_Y_MIN:GPVAL_DATA_Y_MAX]

# set the labels
set title 'Dollars in buckets'
set xlabel 'number'
set ylabel 'Dollars'

set terminal png size xdim,ydim
set output 'test.png'
set size ratio ar

set style data linespoints

replot

对于这些示例数据:

0 50
50 150 
100 400 
150 500 
200 300

我得到了以下曲线图:

它应该是正方形的(我定义了x中的100个单位等于y中的250个单位,数据的范围是[(0,200),(50,500)])。如果我添加另一个数据点(400,300),则输出文件会更宽,正如预期的那样:

要回答您的另一个问题,您可以这样设置y增量:

set ytics <INCREMENT>

上面的脚本提供了一个示例。

这篇关于GNOUPUPT:如何增加我的图表的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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