I am using Octave for all my calculations and plotting. By telling Octave

graphics_toolkit gnuplot

I can create a *.tex-document by

print -dtikz filename.tex

Which I can then use by


In combination with


Only problem is the size of the graph. During my long path to the above findings, I remember an error message saying that gnuplot uses a standard graph size of 560 by 420 pt. In LaTeX, I usually use something like

width = 0.9\textwidth

for non-*.tex graphs and I would like my plots to be approximately that large, because I would not like to fumble around with scaling factors or other parameters. That can sometimes mess up the relative positions of the single graphics items.

How do I change the plot size that Gnuplot creates from Octave?


When using \input{...} as a way of including figures made by Octave or gnuplot you may rescale the image using \resizebox{x}{y}{\input{...}}, where x and y are the required image dimensions in whatever units that you wish. The usage you would like to have requires keeping proportions constant, which would mean typing


where the ! fills the missing height to keep the overall proportions constant. This worked throughout my LaTeX-aware life. However, this does not necessarily look nice, because the image will not be of appropriate scale: text might be minute, figure illegible, etc. If you wish to instead create the figure to have correct size directly in Octave, you should use the papersize property:

h = figure();

% plot your figure here

set(h, "papersize", [100, 100]);

The units used are points. Alternatively, you may use the -Sx,y switch of the print command; the two approaches are equivalent, but I think changing the figure properties is more rewarding and definitely more general, hence powerful.

  • -Sx,y worked but papersize did not. – wkschwartz Nov 4 '15 at 3:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.