Announcement

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

  • dot plot x-label

    Hi, I am trying to produce a dot plot (please see attached). X-axis is avg. time (varname: avgmin; label: "Avg. time in minutes"); y-axis is water source (varname: source).

    I am using this code successfully: graph dot avgmin, over(source)

    However, when I graph it the x-axis reads "mean of avgmin"

    I have tried adding: , xtitle("Average time in minutes") to the end of the code, but without success. When I do this I get error: 'invalid xtitle'.

    Appreciate suggestions.

  • #2
    Please re-register with a family name. See http://www.statalist.org/forums/help#realnames

    While reading the FAQ as requested, please also note the request for showing graphs as .png attachments, not photo attachments. Such attachments are directly readable and do not oblige readers to go back and forth between the attachment and the post itself.

    This kind of plot is often called a (Cleveland) dot chart in a feeble attempt to keep it distinct from a dot plot sensu the Stata command dotplot. Unfortunately you do need to read the documentation to understand what is going on here.

    The help for graph dot makes explicit that by default the plot shows means and also that the response axis (here horizontal) is regarded as the y axis. In fact there is no x axis and the categories shown on the left in your case make up a categorical axis.

    It follows, at least to Stata, that to change the title on the response axis you should specify ytitle()


    Code:
    graph dot avgmin, over(source) ytitle(Average time in minutes)
    In this case, working on the redundancy between the main title and the response axis title, sorting the categories according to mean response, and adding a small offset might help too. The last could be something like

    Code:
    ... ysc(r(-0.5 .))
    Last edited by Nick Cox; 17 Sep 2015, 09:16.

    Comment


    • #3
      Average time is on the y-axis, not the x-axis.
      Code:
      graph dot avgmin, over(source) ytitle("Average time in minutes")

      Comment


      • #4
        Hello Jackie,

        Welcome to the Forum. Please use name and family name (you can re-register by clicking on the "contact us" button, below to the right).

        Indeed, the manual, we read that teh option "xtitle() [...] is irrelevant for dot chart".

        I cannot check further solutions now, but I wonder if you couldn't edit the title of the x axis by applying direct "point and click" resources.

        Best,

        Marcos

        P.S.: sorry for this. When I wrote the short comment, Nick's excellent remarks and Friedrich's code weren't yet visible to me.
        Last edited by Marcos Almeida; 17 Sep 2015, 09:19.
        Best regards,

        Marcos

        Comment


        • #5
          Thank you Nick, Freidrich and Marcos - I wasn't aware of the peculiarities of the dot chart and now understand what to do.
          I've also registered by family name via the 'contact us' button.

          Comment

          Working...
          X