Polar Plot

Version Info

Minimum Origin Version Required: Origin8 SR0

Example

The following function shows how to generate polar plot from worksheet XY column.

void polar_plot()
{
        // prepare wks with data and construct DataRange
        Worksheet wks;
        wks.Create("Origin");     

        DataRange dr;
        dr.Add(wks, 0, "X");
        dr.Add(wks, 1, "Y");
        
        vector vAngle, vData;
        vAngle.Data(30, 360, 30);
        
        vData.SetSize(vAngle.GetSize());
        for(int ii=0; ii < vData.GetSize(); ii++)
                vData[ii] = rnd();
        
        dr.SetData(&vData, &vAngle); // put data from vector to worksheet columns.
                
        // new a graph to plot Polar
        GraphPage gp;
        gp.Create("POLAR");
        GraphLayer gl = gp.Layers(0);
        
        int nn = gl.AddPlot(dr, IDM_PLOT_POLAR);
        if(0 == nn)
        {
                gl.Rescale();
                legend_update(gl); // update legend
        }
}