|
| 1 | +clear all |
| 2 | + |
| 3 | +% create a figure named "hello" (associated with a Matlab figure window) |
| 4 | +tfInit('hello') |
| 5 | +% define a color to be used later |
| 6 | +tfColor('kitty', 'rgb', [1 0 0]) |
| 7 | +% define a style to be used later |
| 8 | +tfStyle('pretty', 'mark=+,draw=orange') |
| 9 | +% define a layout with two boxes side-by-side, |
| 10 | +% the first with a 4:3 aspect ratio and the second one square |
| 11 | +tfLayout({1 1 4/3; 1 2 1}) |
| 12 | + |
| 13 | +% select layout box #1 and define coordinate system |
| 14 | +tfView(1, [0 3], [0 3]) |
| 15 | +tfIsoView |
| 16 | +% draw an arrow from (1, 2) to (2, 1) |
| 17 | +tfPath('green,thick,draw,->', [1 2 ; 2 1]) |
| 18 | +% make a text label |
| 19 | +tfPath('', [0.1 0.1], ... |
| 20 | + 'node [kitty,anchor=south west,draw,fill=yellow] {Hello Kitty! $E = mc^2$}') |
| 21 | +% close layout box and show standard decorations: viewbox and scales |
| 22 | +tfDeco |
| 23 | + |
| 24 | +% select layout box #2 and define coordinate system |
| 25 | +tfView(2, [0.5 9.5], [-0.1 1.1]) |
| 26 | +% plot some random data |
| 27 | +tfPlot('pretty', [1 : 9 ; rand(1, 9)]') |
| 28 | +% close layout box and use scales and a title as decorations |
| 29 | +tfDeco scales |
| 30 | +tfDeco title graph |
| 31 | + |
| 32 | +% generate pdf and show a preview in the associated figure window |
| 33 | +tfRender |
0 commit comments