Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting graph figure size

All I want to do is make the width greater and the height smaller. I'm just doing raster plots but this question applies to any MATLAB figure. I can manually resize it using the figure directly when it's created but I want the program to spit it out in the right size to start with.

like image 289
ale Avatar asked Mar 03 '11 15:03

ale


People also ask

How do you change the size of a figure in Matplotlib?

figure(figsize=(1,1)) would create an inch-by-inch image, which would be 80-by-80 pixels unless you also give a different dpi argument. If you've already got the figure created, say it's 'figure 1' (that's the default one when you're using pyplot), you can use figure(num=1, figsize=(8, 6), ...) to change it's size etc.

What is figure size in Matplotlib?

figsize() takes two parameters- width and height (in inches). By default the values for width and height are 6.4 and 4.8 respectively. Where, x and y are width and height respectively in inches.


1 Answers

The properties that can be set for a figure is referenced here.

You could then use:

figure_number = 1; x      = 0;   % Screen position y      = 0;   % Screen position width  = 600; % Width of figure height = 400; % Height of figure (by default in pixels)  figure(figure_number, 'Position', [x y width height]); 
like image 135
Marcus Frödin Avatar answered Nov 13 '22 11:11

Marcus Frödin