Scatter Plot Matrix

Creates a scatter plot matrix from the columns of the wave 'm'. Plots each column vs. each other column. Several optional variables can be used to specify exact layout.

// May be easier to append manually and then use TileAxes.  
Function ScatterPlotMatrix(m[,left,right,low,high,xLog,yLog,labels,xMargin,yMargin,grout])
    wave m // Matrix to plot.  
    variable left,right // Left and right values for x-axes.
    variable low,high // Low and high values for y-axes.
    variable xLog,yLog // Set x and/or y axes to log scale.  
    string labels // Labels for axes.  
    variable xMargin,yMargin // Margins (as a fraction of graph size) for the axes closests to the edge of the graph window.  Between 0 and 1.  
    variable grout // Grout as a fraction of the graph window size.  
   
    xMargin=paramisdefault(xMargin) ? 0.02 : xMargin
    yMargin=paramisdefault(yMargin) ? 0.02 : yMargin
    grout=paramisdefault(grout) ? 0.02 : grout
   
    display /k=1
    doupdate
    string win=winname(0,1)
    variable i,j,numwaves=dimsize(m,1)
    for(i=0;i<numwaves;i+=1)
        string xAxis
        sprintf xAxis,"x_%d",i
        for(j=0;j<numwaves;j+=1)
            string yAxis
            sprintf yAxis,"y_%d",j
            appendtograph /L=$yaxis /B=$xAxis m[][j] vs m[][i]
            if(!paramisdefault(low) && !paramisdefault(high))
                setAxis /w=$win $yAxis low,high
            endif
            if(paramisdefault(labels))
                string y_label=getdimlabel(m,1,j)
            else
                y_label=stringfromlist(j,labels)
            endif
            label /w=$win $yAxis y_label
            variable yLow=yMargin+j/numWaves*(1-yMargin)//1-(row+1)/rows+yMargin
            variable yHigh=yMargin+((j+1)/numWaves-grout)*(1-yMargin)//1-row/rows-grout
            modifygraph /w=$win axisEnab($yAxis)={yLow,yHigh},freepos($yAxis)={xMargin,kwFraction},log($yAxis)=yLog
        endfor
        if(!paramisdefault(left) && !paramisdefault(right))
            setAxis /w=$win $xAxis left,right
        endif
        if(paramisdefault(labels))
            string x_label=getdimlabel(m,1,i)
        else
            x_label=stringfromlist(i,labels)
        endif
        label /w=$win $xAxis x_label
        variable xLow=xMargin+i/numWaves*(1-xMargin)
        variable xHigh=xMargin+((i+1)/numWaves-grout)*(1-xMargin)
        modifygraph /w=$win axisEnab($xAxis)={xLow,xHigh},freepos($xAxis)={yMargin,kwFraction},log($xAxis)=xLog
    endfor
    modifygraph /w=$win axOffset=-4,axOffset=-1,btLen=1,lblpos=100
End
Is this much different to:

#include <Scatter Plot Matrix 2>
 SPM_FreeAxisPlotMatrix(WavesList, PlotOptions, LabelOptions, Frames[, TraceMode, LineSize, MarkerSize, MarkerNumber])


, apart from the fact that SPM_FreeAxisPlotMatrix works from several 1D waves (which one could concatenate)?

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More