Announcement

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

  • Tabplot-Changing frequency charts

    Dear all,

    Suppose I have the following dataset.

    Code:
    input str8 groupid str8 memberid 
    "A000" "A000" 
    "A000" "A000" 
    "A000" "A000" 
    "A003" "B001" 
    "A004" "B002" 
    "A005" "B003" 
    "A005" "B004" 
    "A009" "B000" 
    "A008" "B003" 
    "A006" "B005" 
    "A006" "B004" 
    "A006" "B005" 
    "A008" "B002" 
    "A007" "B005" 
    "A007" "B006" 
    "A001" "B015" 
    "A001" "B018" 
    "A001" "B019" 
    "A001" "B017" 
    "A001" "B019" 
    "A002" "B000" 
    "A002" "B000" 
    "A002" "B005" 
    end
    I'm able to create a frequency plot by running
    Code:
    tabplot groupid memberid, xlab(,angle(45))
    I just wonder if there is any way to change bar charts into circles.

    Thank you very much,

    Vinh

  • #2
    No; not within tabplot (which is from the Stata Journal, as you are asked to explain).

    There are two levels to my answer.

    1. The underlying code is based on a call to twoway rbar and that is not compatible with recasting to twoway scatter.

    2. In principle, showing frequencies by areas of circles, which I presume is what you want, is fraught with difficulty:

    2a. People don't always judge circles correctly, as they may e.g. see areas but think in terms of something closer to the diameter. Much of the point of tabplot is that frequencies are encoded in terms of lengths or heights, which are unambiguous.

    2b. In Stata circles may appear as slightly flattened ellipses unless you mess around with the aspect ratio.

    Comment


    • #3
      Originally posted by Nick Cox View Post
      No; not within tabplot (which is from the Stata Journal, as you are asked to explain).

      There are two levels to my answer.

      1. The underlying code is based on a call to twoway rbar and that is not compatible with recasting to twoway scatter.

      2. In principle, showing frequencies by areas of circles, which I presume is what you want, is fraught with difficulty:

      2a. People don't always judge circles correctly, as they may e.g. see areas but think in terms of something closer to the diameter. Much of the point of tabplot is that frequencies are encoded in terms of lengths or heights, which are unambiguous.

      2b. In Stata circles may appear as slightly flattened ellipses unless you mess around with the aspect ratio.
      Dear Nick,

      Thank you very much for your response.

      I just wonder if there is any package/code that allows me to show frequencies by area of circles. I just want to have a try with that.

      Thanks a lot,

      Vinh

      Comment


      • #4
        Here's a start:

        Code:
        sysuse auto
        
        bysort foreign rep78 : gen freq = _N
        
        scatter foreign rep78 [fw=freq] , ms(Oh) scheme(s1color) ysc(r(-0.2 1.2)) xsc(r(0.8  5.2)) yla(0 1, valuelabel ang(h)) xla(1/5)
        Click image for larger version

Name:	circleplot.png
Views:	1
Size:	19.4 KB
ID:	1443884
        Last edited by Nick Cox; 12 May 2018, 00:57.

        Comment


        • #5
          Dear Nick,

          Thank you very much for your help.

          Vinh

          Comment

          Working...
          X