Announcement

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

  • Chance order and text size on boxplot

    Hello,

    I have just started working with Stata and I am trying to make a boxplot of the CO2 concentration in different schools. I would like to name the schools on the plot, change the text size and alternate the text. All the commands below work fine separately but I cannot find a way to combine the label()/alternate function with the relabel or sort. I imagine it is just a simple trick but I have spent hours trying to solve it. Can any of you help me out?

    graph box co2 if, over(school, label(labsize(large) alternate))
    graph box co2 if, over(school, relabel(1 "School1" 2 "School2" 3 "School3"))

    Thanks,
    Stine

  • #2
    Note that the code above would not work given the unqualified if

    This works for me:

    Code:
    sysuse auto, clear
    graph box mpg, over(foreign)
    graph box mpg, over(foreign, relabel(1 "US" 2 "alien"))
    graph box mpg, over(foreign, relabel(1 "US" 2 "alien") label(labsize(large) alternate))
    I don't think you have said anything about your dataset that explains why similar syntax should not work. Conversely if your problem is with other syntax you do not show us, then you must give the commands that do not work as you wish and explain why not.

    See also http://www.statalist.org/forums/help#stata
    Last edited by Nick Cox; 19 Feb 2016, 02:31.

    Comment


    • #3
      Dear Nick,

      Thank you very much. It worked perfectly – of cause

      BR,
      Stine



      Comment

      Working...
      X