MatLab® SigmaPlot Functions

 

The following functions are designed to create SigmaPlot graphs from within MATLAB. These can be used to replace the PLOT, BAR, POLAR and SURF functions. The graphs are created in SigmaPlot. Currently, a new SigmaPlot Notebook with the MATLAB graph and data are created each time the function is run.

The graphs created are largely identical to the graphs produced by MATLAB, but with some small differences in default axis ranges and aspect ratio, plus the fact that SigmaPlot graphs are far easier to modify after creation.

SPLOT

Uses the same syntax as PLOT, e.g., SPLOT(x,y,linespec). Has the advantage in that string arrays can be plotted. Type in help “splot” for more information.

For example, the MATLAB commands:

x = -pi:pi/10:pi;

y = tan(sin(x)) – sin(tan(x));

plot(x,y,’rs-‘,’LineWidth’,1,’MarkerEdgeColor’,’k’,

‘MarkerFaceColor’,’g’,’MarkerSize’,10)

Produce:

If you substitute the “splot” function:

splot(x,y,’rs-‘,’LineWidth’,1,’MarkerEdgeColor’,’k’,

‘MarkerFaceColor’,’g’,’MarkerSize’,10)

You get the following graph in SigmaPlot:

SBAR

This uses the same syntax as BAR, including the ability to create stacked bar charts, e.g., SBAR(x,y,’stacked’). Automatically uses the current COLORMAP setting, but does not automatically update to new colormaps. Simply re-run the function and a new graph is created using the new colormap.

SPOLAR

Uses the same syntax as POLAR.

SSURF

Creates a Surface plot using the same syntax for data as SURF. Note that a color dimension is not specifically supported, but that the current COLORMAP setting is automatically used.

In addition, the following functions are provided to allow free data interchange between SigmaPlot and MATLAB:

SCOLORMAP

This function takes any variable set to a MatLab® colormap and converts it to colors from a column inside SigmaPlot™. You must have a SigmaPlot worksheet open to use this function; if you want to format an existing graph, you must have the graph page open as well.

You need to first define a variable to be the colormap values, e.g., cmp=colormap

SCOLORMAP(cmp) takes the current colormap and places it in column 1000

SCOLORMAP(cmp,col) places the color values into the specified column

SCOLORMAP(cmp,col,numcolors) samples the colormap and produces the number of colors requested

SCOLORMAP (cmp,col,numcolors,1) converts the colors of the current plot to the requested colors

For example:

colormap pink

cmp=colormap;

scolormap(cmp,10,16)

16 evenly incremented colors from the pink colormap are placed in column 10

Built-in MATLAB color tables include: autumn, bone, colorcube, cool, copper, flag, gray, hot, hsv, jet, lines, pink, prism, spring, summer, white, and winter.

PUTSP

This function takes any MatLab® variable and places it into a SigmaPlot™ worksheet. If no SigmaPlot worksheet is open, a new notebook and worksheet are automatically created.

PUTSP(X) takes the variable and places it starting in column 1

PUTSP(X,col) places the variable starting in the specified column

PUTSP(X,col) places the variable starting in the specified column and row

Download the file matlab_sigmaplot_functions and double click on it to obtain the SigmaPlot notebook containing this macro.