Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Radar Plot Quesitons

    Introduction

    Best attempt at a "good" question that meets the standards of StataList. Perhaps this is as much an attempt to meet the very high standards of StataList as it is an attempt to get input on implementing radar plots in new ways. After reading the advice on posting I wasn't sure about the following . . .
    • FAQ 3: Searched around and I did not find the implementation I'm looking for. I may have missed it. Please feel free to point me in the right direction if this has already been addressed.
    • FAQ 7: My topic is about radar plotting. I left the title broad because I see there is already at least one implementation of radar plots. But, it doesn't implement the plot in the manner I am seeking.
    • FAQ 11: I'm using the latest version of Stata.
    • FAQ 12.1/12.5: The code (which is self-contained) below indicates the code I'm using. The code also generates data to test and use. I'm posting two pngs that illustrate the final result I am seeking. This section of the FAQ is unclear about posting PNGs as attachments. 12.4 says okay to use .png / but 12.5 says no attachments. I'm posting the PNGs via link to another site. Hope that is okay.
    • FAQ 14: Running Windows 10. Sometimes running Mac OS. I think this question would be mostly independent of OS.
    Background

    I am in search of a way to implement radar plots. I'm aware of the parplot package but I really am in search of radar plotting. Radar plotting is a style of plotting my audience is used to. For the present use case(s), I'd like to provide what the audience is looking for. I'd rather avoid teaching my audience a new plot type.

    Also I found the radar package. It seems to do a nice job at plotting a categorical y (such as automobile make) and a continuous x (automobile weight). In this example the data has one observation for each make. The data includes an entry for that make's weight:

    Code:
        sysuse auto
        radar make weight if foreign
    (Example taken from: -help radar- (if installed)).

    Question / Goal In Mind

    Below is code with comments that seeks to illustrate two other potential use cases. The first would plot a categorical y (such as a series of factor scores) and a continuous x (which would be that factor score's mean). Bonus on this one if the plot could include confidence intervals.

    The second would be to plot a categorical y (such as responses on a Likert-like scale) and a continuous x (such as the number of responses in each categorical / ordinal). This implementation could essentially be thought of as a histogram plotted as a radar.

    Any advice??

    Code:
        set more off
        clear all
        
        // FIRST: Potential implementation of radar plot.
        // Plot the means of a series of factor scores.
        // This implementation would be useful for social 
        // sciences each factor score is an outcome on any
        // given psychometric measurement.
        set obs 1000
        set seed 123456
        gen factor_a = rnormal(20,1.12)  // Fictional factor score
        gen factor_b = rnormal(30,1.25)  // Fictional factor score
        gen factor_c = rnormal(22,1.85)  // Fictional factor score
        gen factor_e = rnormal(26,.756)  // Fictional factor score
        gen factor_f = rnormal(28,1.32)  // Fictional factor score
        sum factor*, sep(0)              // Display factor score means
        
        * facradar factor*               // Imaginary/hypothetical/proposed syntax
        // See for example: https://raw.githubusercontent.com/adamrossnelson/HelloWorld/master/SocRadar.PNG
        // Bonus points if confidence intervals could also be included in the plot
        
        clear all
        
        
        // SECOND: Potential implementation of radar plot.
        // Plot the frequency, density, or percent distribution
        // of a categorical and/or ordinal response on a single
        // variable. Essentially a histogram in radar format.
        set obs 1000
        set seed 123456
        gen scale_response = round(rnormal(3,1.5)) // Fictional scale responses
        replace scale_response = 5 if scale_response > 5
        replace scale_response = 5 if scale_response < 1
        
        label define WANT 1 "Much want RADAR" 2 "Sorta want RADAR" 3 "Want RADAR" 4 "Hate RADAR" 5 "Am RADAR"
        label values scale_response WANT
        tab scale_response
        hist scale_response, discrete
        
        * histradar scale_response       // Imaginary/hypothetical/proposed syntax
        // See for example: https://raw.githubusercontent.com/adamrossnelson/HelloWorld/master/HistRadar.PNG

  • #2
    A few comments about the FAQ. On attachments, we say

    12.4 Posting image attachments: please do use .png

    Stata graphs should be posted as .png file attachments (start with the Clipboard icon).

    See next section 12.5 for why other images (e.g. screenshots) are usually less helpful than you imagine.

    12.5 Posting attachments: please don't...

    There are several "please don't" requests here, but good reasons for them all.

    Please do not post .gph files, as they can't be read without flipping back and forth between Stata and the forum software, thus making your posts much more difficult to follow.

    In particular, please do not post screenshots. Many members will not be able to read them at all; they usually can't be read easily; and they do not allow copy and paste of data or code, which is highly desirable to allow experienced members to make precise suggestions for your questions.

    You are asked not to post attachments that are in Word or Excel file formats (.doc, .docx, .xls, .xlsx),
    I wrote that, so I would think it was clear, but in summary it says (12.4) attachments as .png via the Clipboard are fine, but (12.5) please don't attach the other kinds of files. specified.

    Also, earlier in #12 we ask that we say where user-written programs come from, which in your case is a request to tell us where radar and parplot come from.

    My writing one of the these and not the other indicates my own interests and preferences here.

    I'd post your .png files here. That's what we ask and it will increase interest in this thread.
    Last edited by Nick Cox; 14 Oct 2017, 13:13.

    Comment


    • #3
      Thanks so much for the clarification.

      PNGs attached here.

      Also, parplot is from Nicholas J. Cox. More at: http://fmwww.bc.edu/repec/bocode/p/parplot.html
      And, radar from Adrian Mander. More at: http://fmwww.bc.edu/repec/bocode/r/radar.html
      Attached Files

      Comment


      • #4
        This looks like one program not two to me.

        Strategic hints, other than don't do this:

        1. Use twoway with xscale(off) yscale(off)

        2. The polygons could be drawn as numerous line segments using scatteri, recast(line) and the remaining text (numeric and otherwise) requires numerous calls to the text() option.

        The code of
        triplot (SSC) gives examples.

        Comment


        • #5
          I am still bemused by the idea that any group smart enough to tackle a radar plot would have difficulty with same idea simplified in planar coordinates --especially if one application is to an ordered scale violated by being made circular.

          Still, imperatives are imperatives.

          I write not so much to try to change your mind, as for any others interested in the topic.

          Your real problem -- how many variables, how many observations, what kinds of variations, your purposes -- will shape what's best for you.

          For this toy dataset, a simple dot chart makes it much easier to see what is going on. Even for this I have to work really hard on the radar plot to see even simple things like highest is b, lowest is a, and so forth. If a design is such hard work for simple data, how can it be better for more complicated data?

          Code:
          clear
          input str1 factor score
          a  20
          b  30
          c  22
          d  26
          e  28 
          end 
          
          graph dot (asis) score, over(factor) exclude0 ///
          yla(20(2)30) ysc(r(18 .)) linetype(line) lines(lc(gs12) lw(vvthin))
          Click image for larger version

Name:	dotnotradar.png
Views:	1
Size:	12.4 KB
ID:	1414693

          Comment


          • #6
            Picking this thread up and posting a resource I'm fond of:

            https://asjadnaqvi.medium.com/

            Comment


            • #7
              The spider plot linked to in #8 shows 5 measures for 4 regions. The radial layout is gratuitous. Anyone again: what advantages are there to this plot over just about any bar, dot or line design?
              Last edited by Nick Cox; 21 Feb 2021, 07:22.

              Comment


              • #8
                Adam is perhaps alluding to this thread and others at https://mobile.twitter.com/AdamRossN...06376333099008

                Meanwhile: no one answered the simple and open question in #7...

                I have to suspect that the appeal of spider or radar charts lies at least partly in their being a little different. I agree that intriguingly wacky can beat boringly familiar, with nothing else said, but the first job of a graphic is to inform. Otherwise data art is just what it is.

                Comment

                Working...
                X