Johned
Johned

Reputation: 143

Gnuplot : How to specify the graph width in pixels?

I would like to plot the output of a dataset so that there is one pixel per sample, on the X axis. e.g. if I have a dataset of 500 samples then I would like to ensure that the X axis is 500 pixels wide. Does anyone know how to do this with Gnuplot ?

Thanks very much, John

Upvotes: 3

Views: 2907

Answers (1)

Christoph
Christoph

Reputation: 48440

This request makes sense only for bitmap terminals. In order to get a plotting area with a fixed size, you must both set a respective terminal size and fixed margins. The following script gives a plotting area of 500px width. This includes the 1px thick border lines, which are also part of the plotting area, what you can see, with set border back:

set terminal pngcairo size 600,500
set lmargin at screen 80.0/600
set rmargin at screen 579.0/600

set border back
set output 'output.png'
plot x

Upvotes: 3

Related Questions