Announcement

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

  • How to display the mean on a graph pie

    Hello.

    Is there a way to display the mean when I create a graph pie ?

    My current code is
    Code:
    graph pie worker_small worker_medium worker_large
    But I would like the mean to display somewhere on the graph.

    Thank you.

  • #2
    What does the mean represent for categorical variables? How one assigns categories is arbitrary. Below, I partly show how one can display counts within each pie using the plabel() option.

    Code:
    sysuse census
    qui count if region==1
    local c1= `=r(N)'
    gr pie, over(region) scheme(s1mono) plabel(1 "N=`c1'", color(red) size(large))
    Result:


    Click image for larger version

Name:	Graph.png
Views:	1
Size:	21.8 KB
ID:	1490552

    Comment


    • #3
      The following simplifies Andrew's example and places the count on each slice.
      Code:
      sysuse census
      gr pie, over(region) scheme(s1mono) plabel(_all sum, color(red) size(large))
      Click image for larger version

Name:	pie4.png
Views:	1
Size:	109.5 KB
ID:	1490574
      See also the similar discussion from a day ago at
      https://www.statalist.org/forums/for...on-a-graph-pie
      Last edited by William Lisowski; 28 Mar 2019, 06:58.

      Comment

      Working...
      X