Controlling Report Width


mathlayer® plotting functions have a default width of 600px.

This tutorial explains how to play with this option and the function assemble to get diferents results.

Default width

Only one graph fits into the assemble width.

x = -15:0.1:5			

% defining X values

o1 = struct

% initializing options struct, first graph options

o1.show = false p1 = scatter(rand(50,5),o1) o2 = o1

% initializing options struct, second graph options

p2 = plot(x, airy(x),o2) assemble({p1,p2})

Using 1200px width

Both graphs fit into the assemble width.

x = -15:0.1:5		

% defining X values

o1 = struct

% initializing options struct, first graph options

o1.show = false p1 = scatter(rand(50,5),o1) o2 = o1

% initializing options struct, second graph options

p2 = plot(x, airy(x),o2) o = struct

% initializing options struct, options for assemble

o.width = 1200 assemble({p1,p2},o)

Specifying individual graphs width in pixels

Control of the graphs into a line of graphs.

x = -15:0.1:5		

% defining X values

o1 = struct

% initializing options struct, first graph options

o1.show = false o1.width = 400 p1 = scatter(rand(50,5),o1) o2 = o1

% initializing options struct, second graph options

o2.width = 900 p2 = plot(x, airy(x),o2) o = struct

% initializing options struct, options for assemble

o.width = 1300 assemble({p1,p2},o)

Specifying individual graphs width in percentages

If the size of the window is smaller than 1300px, the graphs will be resized to fit the window proportionally.

x = -15:0.1:5		

% defining X values

o1 = struct

% initializing options struct, first graph options

o1.show = false o1.width = 0.3 p1 = scatter(rand(50,5),o1) o2 = o1

% initializing options struct, second graph options

o2.width = 0.7 p2 = plot(x, airy(x),o2) o = struct o.width = 1300 assemble({p1,p2},o)

Specifying height

In this example the second assembled graph will be a pair of assembled plots with smaller height.

x = -15:0.1:5		

% defining X values

% first block

o1 = struct

% initializing options struct, first graph options

o1.show = false o1.width = 400 as1 = scatter(rand(50,5),o1)

% second block

o2 = o1

% initializing options struct

o2.width = 900 o2.height = 225 p2 = plot(x, sin(x),o2)

% first graph of second block

o3 = o2

% initializing options struct

p3 = plot(x, cos(x),o3)

% second graph of second block

o4 = o1

% initializing options struct, second block options

o4.width = 900 as2 = assemble({p2,p3},o4)

% assemble graphs of second block

% final graph

o = struct

% initializing options struct, options for assemble

o.width = 1300 assemble({as1,as2},o)

Related functions

assemble