Announcement

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

  • Pie chart move percentages outside the chart

    Hi

    I am making a pie chart with percentages, however would like to move percentages outside the chart, how can I do that?

    Click image for larger version

Name:	Agegroup.PNG
Views:	1
Size:	4.9 KB
ID:	1727194



    . graph pie eggfrys, over(agegroup) plabel(_all percent)

    Click image for larger version

Name:	piechart.PNG
Views:	1
Size:	21.3 KB
ID:	1727195


    Any tips? Also how can you constrain to to 1 decimal place?

    Cheers

  • #2
    See the -gap()- suboption in

    Code:
    help graph pie
    Code:
    sysuse census, clear
    set scheme s1color
    gr pie pop, over(region) plabel(_all percent, gap(22))
    Res.:
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	22.5 KB
ID:	1727201

    Comment


    • #3
      Originally posted by Andrew Musau View Post
      See the -gap()- suboption in

      Code:
      help graph pie
      Code:
      sysuse census, clear
      set scheme s1color
      gr pie pop, over(region) plabel(_all percent, gap(22))
      Res.:
      [ATTACH=CONFIG]n1727201[/ATTACH]

      Perfect that works thanks!

      Comment


      • #4
        An alternative which many people find clearer is a bar chart. Here I use the data example of Andrew Musau and show one way to get a horizontal bar chart.

        Note that showing percents makes a numeric y axis redundant. And we can lose the legend too given direct labelling.

        Code:
        sysuse census, clear
        set scheme stcolor
        
        * ssc install catplot 
        catplot region [fw=pop], percent var1opts(sort(1) descending) ///
        blabel(bar, format(%3.1f)) ysc(off) subtitle(% of total population 1980)
        Click image for larger version

Name:	popbar.png
Views:	1
Size:	21.7 KB
ID:	1727218



        Comment

        Working...
        X