Difference between revisions of "Retrospective Formatting"
m |
m |
||
Line 1: | Line 1: | ||
==Changing Plot Axes== | ==Changing Plot Axes== | ||
+ | |||
===Limits=== | ===Limits=== | ||
+ | |||
+ | The axes limits in x, y, z or colour can be changed by the commands lx, ly, lz and lc respectively. Colour limits define the lowest and highest values to which colours are allocated. Anything below the lower limit will be the lowest colour and any points above the upper limit will be the highest colour. | ||
+ | |||
+ | <pre>>> lx(xlo, xhi) | ||
+ | >> ly(ylo, yhi) | ||
+ | >> lz(zlo, zhi) | ||
+ | >> lc(clo, chi)</pre> | ||
+ | |||
+ | * If the selected plot is an [[Plot Commands#Two Dimensional Plots|area]] plot then lz and lc both change the colour scale | ||
+ | * lz and lc are not applicable for [[Plot Commands#One Dimensional Plots|one dimensional]] plots | ||
+ | * If no limits are given to a command the following happens: | ||
+ | ** lx - x limits are between the lowest and highest value of x in the data | ||
+ | ** ly - y limits are between the lowest and highest value of y in the data contained within the current x limits | ||
+ | ** lz/lc - z/c limits are between the lowest and highest value of z in the data contained within the current x and y limits | ||
+ | |||
+ | |||
===Changing the Scale to Log=== | ===Changing the Scale to Log=== | ||
+ | The axes scale for x, y, z and colour can be changed to a logarithmic scale using the commands logx, logy, logz and logc respectively. | ||
+ | |||
+ | <pre>>> logx | ||
+ | >> logy | ||
+ | >> logz | ||
+ | >> logc</pre> | ||
+ | |||
+ | * If the selected plto is an [[Plot Commands#Two Dimensional Plots|area]] plot then logz and logc both change the colour scale | ||
+ | * logz and logc are not applicable for [[Plot Commands#One Dimensional Plots|one dimensional]] plots | ||
+ | * If the scale is already logarithmic then nothing happens (i.e. no warning or error is given) | ||
+ | |||
+ | Similarly, the axes scale for x, y, z and colour can be changed to a linear scale using the commands linx, liny, linz and linc respectively. | ||
+ | |||
+ | <pre>>> linx | ||
+ | >> liny | ||
+ | >> linz | ||
+ | >> linc</pre> | ||
+ | |||
+ | * If the selected plto is an [[Plot Commands#Two Dimensional Plots|area]] plot then linz and linc both change the colour scale | ||
+ | * linz and linc are not applicable for [[Plot Commands#One Dimensional Plots|one dimensional]] plots and will simply do nothing | ||
+ | * If the scale is already linear then nothing happens (i.e. no warning or error is given) | ||
+ | |||
+ | |||
===Changing the Aspect Ratio=== | ===Changing the Aspect Ratio=== | ||
+ | |||
+ | <pre>>> aspect(x_ulen, y_ulen, z_ulen)</pre> | ||
+ | |||
+ | * Aspect ratio is changed so that x_ulen in the x axis, y_ulen in the y axis and z_ulen in the z axis have the same length on screen | ||
+ | * z_ulen is optional, if not given and applicable then the z axis retains its height (not its aspect ratio) | ||
+ | |||
+ | |||
+ | Alternaltively instead of changing the aspect ratio for the current axes, one can give the function an axes handle or the name and tag of the plot to change. | ||
+ | |||
+ | <pre>>> aspect('name', 'tag', x_ulen, y_ulen, z_ulen) | ||
+ | >> aspect(axesHandle, x_ulen, y_ulen, z_ulen)</pre> | ||
+ | |||
+ | |||
+ | * Only plots with the given name and tag or axesHandle will be altered | ||
+ | |||
+ | |||
+ | One can also let Matlab decide the appropriate aspect ratio to fill the figure by typing | ||
+ | |||
+ | <pre>>> aspect(axesHandle, 'auto') | ||
+ | >> aspect('name', 'tag', 'auto')</pre> | ||
+ | |||
==Adding a Legend== | ==Adding a Legend== | ||
+ | To add a legend to a [[Plot Commands#One Dimensional Plots|one dimensional]] plot, use the command | ||
+ | |||
+ | <pre>>> set_legend('string1', 'string2', ...)</pre> | ||
+ | |||
+ | * Adds a legend to the current plot | ||
+ | * Strings should be in the reverse order to the order that lines were plotted | ||
+ | |||
+ | |||
+ | '''''EXAMPLE:''''' | ||
+ | |||
+ | |||
+ | <pre>>> dl(w1,'color','red') | ||
+ | >> pm(w2, 'color','blue') | ||
+ | >> pm(w3, 'color','green') | ||
+ | >> set_legend('marker plot of w3', 'marker plot of w2',... | ||
+ | 'line plot of w1')</pre> | ||
+ | |||
+ | * Red line will be labeled 'line plot of w1', blue markers will be labeled 'marker plot of w2', green markers will be labelled 'marker plot of w3' | ||
+ | |||
==Finding Points on a Plot== | ==Finding Points on a Plot== |
Revision as of 16:11, 20 March 2008
Changing Plot Axes
Limits
The axes limits in x, y, z or colour can be changed by the commands lx, ly, lz and lc respectively. Colour limits define the lowest and highest values to which colours are allocated. Anything below the lower limit will be the lowest colour and any points above the upper limit will be the highest colour.
>> lx(xlo, xhi) >> ly(ylo, yhi) >> lz(zlo, zhi) >> lc(clo, chi)
- If the selected plot is an area plot then lz and lc both change the colour scale
- lz and lc are not applicable for one dimensional plots
- If no limits are given to a command the following happens:
- lx - x limits are between the lowest and highest value of x in the data
- ly - y limits are between the lowest and highest value of y in the data contained within the current x limits
- lz/lc - z/c limits are between the lowest and highest value of z in the data contained within the current x and y limits
Changing the Scale to Log
The axes scale for x, y, z and colour can be changed to a logarithmic scale using the commands logx, logy, logz and logc respectively.
>> logx >> logy >> logz >> logc
- If the selected plto is an area plot then logz and logc both change the colour scale
- logz and logc are not applicable for one dimensional plots
- If the scale is already logarithmic then nothing happens (i.e. no warning or error is given)
Similarly, the axes scale for x, y, z and colour can be changed to a linear scale using the commands linx, liny, linz and linc respectively.
>> linx >> liny >> linz >> linc
- If the selected plto is an area plot then linz and linc both change the colour scale
- linz and linc are not applicable for one dimensional plots and will simply do nothing
- If the scale is already linear then nothing happens (i.e. no warning or error is given)
Changing the Aspect Ratio
>> aspect(x_ulen, y_ulen, z_ulen)
- Aspect ratio is changed so that x_ulen in the x axis, y_ulen in the y axis and z_ulen in the z axis have the same length on screen
- z_ulen is optional, if not given and applicable then the z axis retains its height (not its aspect ratio)
Alternaltively instead of changing the aspect ratio for the current axes, one can give the function an axes handle or the name and tag of the plot to change.
>> aspect('name', 'tag', x_ulen, y_ulen, z_ulen) >> aspect(axesHandle, x_ulen, y_ulen, z_ulen)
- Only plots with the given name and tag or axesHandle will be altered
One can also let Matlab decide the appropriate aspect ratio to fill the figure by typing
>> aspect(axesHandle, 'auto') >> aspect('name', 'tag', 'auto')
Adding a Legend
To add a legend to a one dimensional plot, use the command
>> set_legend('string1', 'string2', ...)
- Adds a legend to the current plot
- Strings should be in the reverse order to the order that lines were plotted
EXAMPLE:
>> dl(w1,'color','red') >> pm(w2, 'color','blue') >> pm(w3, 'color','green') >> set_legend('marker plot of w3', 'marker plot of w2',... 'line plot of w1')
- Red line will be labeled 'line plot of w1', blue markers will be labeled 'marker plot of w2', green markers will be labelled 'marker plot of w3'