Radar (Spider) Plot

Igor seems a little incomplete without the ability to generate radar plots: https://en.wikipedia.org/wiki/Radar_chart

I don't see this functionality anywhere so I am adding it to the wish list.

 

 

As far as I understand, radar plots are just polar plots with category labels?

You can access the polar plot package through Windows->New->Packages->Polar Graph

The angle wave you provide will determine how each category is spread around the circle, and you'll also need a text wave that provides the labels for each category. It looks like user-defined axis labels aren't allowed in polar plots at this point, so to hack our way into it you could run something like this:

Function LabelPolar(graphName,w)
    String graphName
    Wave/T/Z w
   
    If(!WaveExists(w))
        return 0
    EndIf
   
    DoWindow $graphName
    If(!V_flag)
        return 0
    EndIf
   
    //Get the boundaries of the prog axis layer draw commands
    DrawAction/L=ProgAxes/W=$graphName getgroup=_all_  
    Variable endPos = V_endPos
    Variable startPos = V_startPos
   
    //Get the drawing code for the layer as well
    DrawAction/L=ProgAxes/W=$graphName commands
   
    SetDrawLayer/W=$graphName ProgAxes
   
    Variable nCategories = DimSize(w,0)
    Variable i, pos = 0, drawPos = strlen(S_recreation) - 1

    //Loop through each category and remove the angle label, replacing it
    //with the text in the category wave at the same x/y coordinates
    For(i=0;i<nCategories;i+=1)
   
        //Gets position of last draw command and its index
        drawPos = strsearch(S_recreation,"DrawText",drawPos-1,3)
       
        If(drawPos == -1)
            continue
        EndIf
       
        //Get the end of line location after the DrawText call
        Variable endOfLine = strsearch(S_recreation,"\r",drawPos)
       
        If(endOfLine == -1)
            continue
        EndIf
       
        //Get the location of the draw command from that drawtext call
        pos = strsearch(S_recreation,"ITEMNO:",drawPos,3)
       
        If(pos == -1)
            continue
        EndIf
       
        //Extract the command index
        String drawIndexStr = S_recreation[pos,drawPos]    
        Variable drawIndex = NumberByKey("ITEMNO",drawIndexStr,":",";")
       
        //Full DrawText call with the x,y coordinates
        String drawStr = S_recreation[drawPos,endOfLine]
       
        //Get the coordinates used in the draw command
        String locationStr = drawStr[strlen("DrawText "),strlen(drawStr)-1]
        Variable xLoc = str2num(StringFromList(0,locationStr,","))
        Variable yLoc = str2num(StringFromList(1,locationStr,","))
       
       
        //Delete and replace the draw call     
        DrawAction/L=ProgAxes/W=$graphName delete=drawIndex,drawIndex
        DrawAction/L=ProgAxes/W=$graphName beginInsert=drawIndex
        DrawText/W=$graphName xLoc,yLoc,w[DimSize(w,0) - 1 - i]
        DrawAction/L=ProgAxes/W=$graphName endInsert
    EndFor
End

where graphName is the name of the graph window, and w is a text wave containing category labels that correspond to the angles in the angle wave.

The problem is that the original angles will be redrawn every time you adjust the graph size, etc., so I would only run the category label code once you're ready to export the graphic as an image. You could probably trigger this code through a window resize hook to get around that problem though.