Announcement

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

  • vertical graph dot

    is it possible to have a vertical (rather than the default horizontal) dot graph (either using graph dot or using some other command)? I have a client who likes the dot graph I have produced but thinks it possible that a vertical version would look even better (with angled labels of course); however, I don't see anything in graph dot that would allow this (recall that graph dot is, basically, the same as graph hbar)

  • #2
    There is an undocumented vertical option to graph dot. Just remember that it doesn't change the rule (local to graph bar|hbar|box|hbox|dot) that the y axis is that of the response, regardless of whether that axis is horizontal or vertical.

    Comment


    • #3
      thanks - that gives me a vertical dot chart; however, I appear unable to get the labels on the horizontal axis to be angled

      I am using "asyvars over(model) over(impair)" as options and the labels are the labels on the "impair" variable (i.e., the labels that I want to angle at 45 degrees are those for the "impair" variable)

      Comment


      • #4
        It's a sub-option of over().

        Code:
         
        sysuse auto, clear
        graph dot (mean) mpg, over(foreign) nofill vertical
        graph dot (mean) mpg, over(foreign, label(ang(vertical))) nofill vertical
        graph dot (mean) mpg, over(foreign, label(ang(45))) nofill vertical

        Comment


        • #5
          Thank you - that worked fine

          2 follow-up questions: I could not find any help (not even in -h undocumented-) for the "vertical" option - how can it be found; second, similarly, the help for "over" shows that there are sub-options, but this is not clickable and so finding what the sub-options are was very difficult (for me anyway) is there an easy way?

          Comment


          • #6
            Code:
             
            help undocumented
            shows some of the undocumented commands; it nowhere, so far as I know, documents undocumented options of documented commands.

            Already this may sound like some spoof reminiscent of e.g.. http://en.wikipedia.org/wiki/There_are_known_knowns but I will endeavour to tell the truth as I know it. Be assured of a straight face and an intent to explain, unless you suspect the opposite.

            1. Clearly, some commands, indeed many, are documented in on-line help and the manuals.

            2. Some commands are not documented in the manuals but are documented in on-line help for which help undocumented is one entry point.

            3. Some commands are not documented anywhere.

            Thus Stata, meaning StataCorp, use the word "undocumented" in a very precise (some might say perverse) sense for stuff that is partially documented. Stuff that is not documented should be called (you should guess) "not documented", not "undocumented".

            A reasonable question is thus (e.g.) how do I know that a vertical option exists for graph dot and my recollection is that I guessed it might exist and found that was correct. I should add that in general this is a lousy and mostly unsuccessful method of finding things out, just satisfying when it works.

            More generally, Stata users find out about non-documented commands in one or more of three ways:

            1. They read code, find commands they haven't seen documented, and work out what they do.

            2. They learn about them from Stata developers, say at users' meetings.

            3. They are mentioned on Statalist or in the Stata Journal by people who did #1 or #2 or read Statalist or the
            Stata Journal.

            In this particular case, I don't think there is more to the vertical option of graph dot than you would guess, but I can't be certain because (here we go again) there is no documentation.

            help graph dot includes the following, and you can click through to further information.

            Code:
             The over_subopts -- used in over(varname, over_subopts) and, on rare occasion, in yvaroptions(over_subopts) -- e
            
                over_subopts                    Description
                --------------------------------------------------------------------------------------------------------------------------------------
                relabel(# "text" ...)           change axis labels
                label(cat_axis_label_options)   rendition of labels
                axis(cat_axis_line_options)     rendition of axis line
            
                gap([*]#)                       gap between lines within over() category
                sort(varname)                   put lines in prespecified order
                sort(#)                         put lines in height order
                sort((stat) varname)            put lines in derived order
                descending                      reverse default or specified line order
                --------------------------------------------------------------------------------------------------------------------------------------


            Comment


            • #7
              Note also possibilities such as

              Code:
               
              sysuse auto, clear
              collapse mpg, by(foreign)
              dotplot mpg, over(foreign)
              dotplot mpg, over(foreign) ysc(r(0 .)) xla(, ang(45))
              In this example tilting at 45 deg is very silly, but the implication of Rich's question is that he has more labels and/or longer labels, so that he is obliged to tilt labels if he goes vertical.

              Comment


              • #8
                thank you Nick, and, be assured that I take what you say as seriously as ever (and yes, some of the labels are quite long and need to be angled if one wants a vertical graph)

                Comment

                Working...
                X