Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: bar graph axis color- frustrated

 From "Michael N. Mitchell" To statalist@hsphsun2.harvard.edu Subject Re: st: bar graph axis color- frustrated Date Fri, 11 Jun 2010 16:29:17 -0700

```Dear Michael

I think you can use the -marker()- option...

```
graph dot (asis) mean*, over(var) name(reshape, replace) marker(1, msymbol(Oh)) marker(2, msymbol(d))
```
Does that do the trick?

Michael N. Mitchell
Data Management Using Stata      - http://www.stata.com/bookstore/dmus.html
A Visual Guide to Stata Graphics - http://www.stata.com/bookstore/vgsg.html
Stata tidbit of the week         - http://www.MichaelNormanMitchell.com

On 2010-06-11 4.19 PM, Michael McCulloch wrote:
```
```On this example code of dot plots, how would one change the dots to
other shapes?
Following -help graph dot-, I tried:
graph dot (asis) mean*, over(var) name(reshape, replace) dots(msymbol(o d))
attributes used

**** begin David's example ****
sysuse auto,clear
local i = 1
foreach var of varlist mpg head turn gear {
local l`var' : var label `var'
local a " `a' `i' `"`l`var''"' "
local ++i
}
collapse mpg head turn gear, by(fore)
stack mpg head turn gear, into(a) clear
label def _stack `a'
label val _stack _stack
bys _s: gen origin = _n -1
reshape wide a, i(_s) j(origin)
label var a0 "Domestic"
label var a1 "Foreign"
graph dot (asis) a*, over(_s) name(stack, replace)

/* Dave */
sysuse auto,clear
collapse (mean) mpg head turn gear, by(foreign)
foreach var of varlist mpg-gear {
rename `var' mean`var'
}
gen row = _n
reshape long mean, i(row) j(var) string
drop row
reshape wide mean, i(var) j(foreign)
label var mean0 "Domestic"
label var mean1 "Foreign"
graph dot (asis) mean*, over(var) name(reshape, replace)

**** end David's example ****

On Jun 11, 2010, at 3:27 PM, Kieran McCaul wrote:

```
```...

OK, I agree, Nick. Putting more examples into the documentation would
be unnecessary, but I do think that the documentation could be a little
clearer.

I rarely do bar graphs, but let's say I had to do one.

I first generate the bar graph with the minimal number of options set.
It looks OK, so now I start modifying it to get the final graph that I
want.

One of the things I want to do is specify axes of a certain width and
colour. Now I know how to do this for scattergrams, line graphs, etc,
so this should be no big deal, so naively I add in -xscale(lw(*2)
lc(red))-, but this doesn't work.

OK, so I look at the help file and I see "axis_options". Fine, I look
at these.

There is nothing in there about the x-axis, other than the option
-xalternate-; everything else is about the y-axis.

How do I set the options for the x-axis? Where do I look? I'm not
going to believe that the programmers who wrote -graph bar- didn't
anticipate that someone would want to tinker with the look of the
x-axis, so I "know" the options will be in there.

So I go back up to the top of the help file and start reading it, line
by line, and eventually I find them: -axis(cat_axis_line_options)- is
one of the options of -yvaroptions-.

Now this seems a tad obscure to me. If I'm looking for axis options and
I see a hyperlink called axis_options, then that's where I would go.
I'm hardly going to go looking in -yvaroptions-.

So, I think the help file could be a bit more helpful. By all means
keep the x-axis options in -yvaroptions-, but I think that it would be
helpful to have a note in the -axis_options- that simply said something
like "If you want to alter the characteristics of the x-axis, go to the
options listed under -yvaroptions-".

Kieran

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: Friday, 11 June 2010 6:03 PM
To: statalist@hsphsun2.harvard.edu
Subject: RE: st: bar graph axis color- frustrated

This isn't (meant to be) contentious, but the thread does underline that
none of half-a-dozen experienced Stata users knew the answer just like
that, including Michael Mitchell who has written an entire book on Stata
graphics.

(I was asleep, but I wouldn't have known either.)

But the solution is documented and the tail statement in

"yvaroptions(over_subopts) allows you to specify over_subopts for the
yvars. This is seldom done."

appears to be quite correct.

There is a fine line between answering all possible questions and
bloating the documentation further. Sometimes the longer your help
files, the less people are inclined to read through them.

Nick
n.j.cox@durham.ac.uk

Kieran McCaul

it's really buried away, isn't it.

Changing the look of the category axis is really something I would
expect people would want to do. Perhaps the Graphics Manual could be
updated to show a few examples.

*
* 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/

*
* 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/
```
```

Best wishes,

Michael McCulloch, LAc MPH PhD
Pine Street Foundation
124 Pine Street
San Anselmo, CA 94960-2674
tel: 415-407-1357
fax: 206-338-2391

*
* 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/
```
```*
*   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/
```