Announcement

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

  • Issue with xlabel command

    Hello, I am trying to change the labels of a graph (without using the editor)

    Code:
    graph box job_hours if expectation == 2, over(gift_received)
    Now as you can see from the attachment the x-axis has labels 1 and 2. I would like to change these to gift received for 1 and no gift received for 2.

    I tried

    Code:
    graph box job_hours if expectation == 2, over(gift_received) ytitle(Hours worked per Week) xlabels(1 "Gift received" 2 "No gift received")
    As shown in the help file, but it doesn't work, I get the error message "xlabels(1 Gift not found" (without the "")

    What am I doing wrong? I checked in the variable and it only consists of 1 and 2, these aren't renamed or were changed in anyway. So what am I doing wrong?
    Attached Files

  • #2
    On these graphs, there is no such thing as an x-axis. Instead, you have a categorical axis. You want to specify the -relabel()- option within -over()-.

    Code:
    graph box ..., over(gift_received, relabel(1 "Gift received" 2 "No gift received"))

    Comment


    • #3
      Thank you very much!

      Comment

      Working...
      X