[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Juan Solon <juan.solon@lshtm.ac.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
RE: st: modifying added line length and location / modifying direction of jitter |

Date |
Fri, 20 May 2005 17:01:48 +0000 |

Svend,

Thank you very much for pointing out dotplot which was there all along.

dotplot price, by(foreign) center median msymbol(oh)

gives me what I wanted, except that I do not have limited control over the line denoting the average.

The symbol denoting the average can be controlled through msymbol as the second on the list, if the bar option is not used. This limits what you can use to what is in the symbolstyle list. I know that what is on the list is enough for most needs, but I was wondering if there is a way to add a customised symbol to the symbolstyle list?

Since I wanted a dashed line:

I have used dotplot with the added text option to place a dashed line at the median - although the length of the dash is just a question of trial and error.

sysuse auto, clear

qui sum price if foreign==0, detail

local 0=r(p50)

qui sum price if foreign==1, detail

local 1=r(p50)

dotplot price, by(foreign) center median ///

msymbol(oh) ///

text("`0'" 0 "-------------") text("`1'" 1 "-------------")

Thanks you again for pointing me in the right direction.

Juan

From Svend

Juan want to plot a continuous variable against

a categorical variable, including the medians.

I think [R] dotplot is what you need. Please note

that it is in the reference manual and is different

from [G] graph twoway dot.

Hope this helps.

Svend

From Juan

Instead of using - gr box - in stata, I wanted to use stata's scatter

plot to produce a graph plotting a continuous variable against a

categorical variable, mainly because this is how this particular

laboratory assay is commonly presented.

I am using Stata version 8.2 on a MacOSX. Using the commands below:

sysuse auto, clear

scatter price foreign, jitter(20) msymbol(Oh) xlabel(0 1, valuelabel)

///

yline(4782, noextend) yline(5759, noextend) ///

xscale(noline) ///

xline(0 1, lpattern(dash)) ///

plotr(m(l=15 r=15))

I end up with a graph with :

1) y lines (which represent the median for each category) that are

too long for what I want - I would want to specify length and location

of the y- line along the x axis -

How do I adjust the length of the added line to cover only the category

of interest ? I couldn't find any suboption in linestyle or added

linestyle.

2) data points which appear to jitter to the right (for Domestic) or

to the left (for Foreign) of the tick label, so the scatter points end

up havign a visual left or right margin.

Is it possible to have the jittering occur randomly to the left or

right of a vertical reference line?

Is there another way of doing this type of graph without using

scatter?

Thanks,

Juan

*

* For searches and help try:

* http://www.stata.com/support/faqs/res/findit.html

* http://www.stata.com/support/statalist/faq

* http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**Re: st: RE: suppress correlation matrix** - Next by Date:
**Statalist: version 9 and meta-analysis** - Previous by thread:
**st: RE: suppress correlation matrix** - Next by thread:
**Statalist: version 9 and meta-analysis** - Index(es):

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