Announcement

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

  • How to reduce the distance between values in a dotplot

    Dear all,

    I'm trying to figure out how to reduce the distance between two values in a dot plot. I have a very simple dichotomous variable with about 700 observations that I would like to display graphically with horizontal bars (such as in a dot plot). However, whenever I graph the variable using the dotplot command I get a graph with a large gap between the two values (in this case 1 and 2, coded as Yes and No). While the graph presents the data accurately it doesn't look all that great. I worked out how to remove the incremental scale markers (1.2, 1.4, etc.) but the distance between the values of 1 and 2 remains the same. I tried both the gap and the linegap commands but neither is allowed. I feel this should be a very simple thing to do yet for the life of me I can't figure it out. Am I missing something obvious? Any help would be most appreciated.

    Here's the command I used and a picture of the resulting graph.

    dotplot double_major, yscale(reverse) ylabel(1(1)2, angle(horizontal) valuelabel)

    Click image for larger version

Name:	Graph1.png
Views:	2
Size:	22.7 KB
ID:	152980

    Thanks, Jon
    Attached Files

  • #2
    The real problem is the aspect ratio of the graph. Stata's imperative is that it will use the space to show the range of the data. You could squeeze the two lines together by using ysc() to extend the range but adding an option such as aspect(0.25) will probably be better yet.

    Comment


    • #3
      Thanks Nick, that is just what I was looking for. One other quick question which just sprung to mind - is there anyway of adding the count to each bar in a dot plot? In the example I provided, I had 110 yes's and 547 no's. Any way of displaying that in the graph?

      Comment


      • #4
        Long-term Statalist members will note that I was uncharacteristically restrained in not commenting on your choice of a dotplot here. For most purposes you would be better off with something like catplot (SSC) here. Indeed, if two counts are all the information, a graph is a little over the top, as all the information can be put in one sentence of text.

        Comment


        • #5
          Well I thank you for cutting a newbie some slack! I'll take a look at catplot and have a think whether it even makes sense to display these data in a graph. The idea was to display all of the variables (most of which have more than two counts) in the same format for easy viewing but maybe in some cases a simple table or line of text would be better. Thanks again - Jon

          Comment

          Working...
          X