ulrichb
ulrichb

Reputation: 20044

How can I set the window size of a plot window?

Is it possible to set the window size / position of a plot window (figure)?

plot(0:20, sin(0:20))

Or is there any other possibility to change the size of the print() command?

print('aa.png', '-dpng')

Because the -Sxsize,ysize parameter doesn't change anything. The size of the written picture (aa.png) has always the same size as the plot window.

I'm using Octave 3.0.

Upvotes: 19

Views: 71151

Answers (3)

Mike Godin
Mike Godin

Reputation: 3937

As of octave version 4.2.2, the following works, as pointed out by Janusz Lenar:

print('filename.png', '-dpng', '-S1280,720');

Which scales the figure to create a 1280x720 pixel image.

Upvotes: 7

user73613
user73613

Reputation:

Yes, it is possible:

figure(1, 'position',[startx,starty,width,height]);
plot(0:20,sin(0:20));

[startx,starty] are the coordinates for the lower left corner of your figure (window).

You can also use the resolution option of the print function

print('aa.png','-dpng','-r300');

I guess the first solution might be better...

Regards

Upvotes: 25

Bojan Petrovic
Bojan Petrovic

Reputation: 199

You can use the code below if you want to maximize:

figure(1,"position",get(0,"screensize"))

Upvotes: 12

Related Questions