Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: AW: Gap between lines in dot plot


From   vwiggins@stata.com (Vince Wiggins, StataCorp)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: AW: Gap between lines in dot plot
Date   Tue, 03 Nov 2009 12:22:00 -0600

Friedrich Huebler <fhuebler@gmail.com> asks,

> How can the lines in a dot plot with over() be moved closer
> together?  The gap() option has no effect.
>
> . sysuse auto
> . graph dot mpg turn, over(rep78) name(dot1)
> . graph dot mpg turn, over(rep78, gap(*.5)) name(dot2)
>
> I expected the lines in the second graph to be closer together but
> both graphs look the same.

I have found that illustrating this question is way beyond my
abilities as an ASCII artist.  So, if you are interested, I
suggest you open Stata and then draw the graphs that follow.

Friedrich is right, there is no difference in these two graphs.

    . sysuse auto
    . graph dot mpg turn, over(rep78)
    . graph dot mpg turn, over(rep78, gap(*.5)) 
                                      ^^^^^^^^

This is subtle and technical, but what it comes down to is that
there are no "gaps" in the first graph.  There is just an axis
with the values of -rep78- evenly spaced.

This graph, however does have a gap,

    . graph dot mpg turn, over(rep78) over(foreign)

The gap is not between the values of rep78.  Those are, again,
just evenly spaced values on an axis.  The two rep78 axes
(determined by the two values of foreign) do, however, have a
gap between them.  So,

    . graph dot mpg turn, over(rep78) over(foreign, gap(*.1))
                                                    ^^^^^^^^

does have an effect.

In Friedrich's original graph, the axis wants to take up all of
the space on the graph.  If Friedrich want to scrunch the lines
together in the middle, he can specify an outer gap, e.g.,

    . graph dot mpg turn, over(rep78) outergap(150)

I have asked Friedrich privately if this is the effect he seeks.

I am hoping that this question relates to a graph for
Friedrich's blog.  If you are interested in some effective use
of graphics, and in particular Stata graphics, take a look at,

     http://huebler.blogspot.com/

Which is not to imply that the content isn't interesting too.


-- Vince 
   vwiggins@stata.com

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index