Statalist


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

Re: st: RE: Bar graph with yvaroptions


From   Friedrich Huebler <fhuebler@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Bar graph with yvaroptions
Date   Mon, 20 Apr 2009 18:18:37 -0400

Nick presented a solution with -twoway bar-. The original bar graph
can also be modified with -gr_edit-.

sysuse auto, clear
gen blank = .
#delimit ;
graph bar rep78 blank headroom gear_ratio, showyvars
 yvaroptions(relabel(1 "Repair record" 2 " " 3 "Headroom" 4 "Gear ratio"))
 legend(off);
gr_edit .varaxis.major.delete_tick 2;
gr_edit .varaxis.major.num_rule_ticks = 0;
gr_edit .varaxis.edit_tick 1 15.9091 `""Repair" "record""', tickset(major);

Friedrich

On Mon, Apr 20, 2009 at 12:47 PM, Friedrich Huebler <fhuebler@gmail.com> wrote:
> Thank you, Nick.
>
> Friedrich
>
> On Mon, Apr 20, 2009 at 11:56 AM, Nick Cox <n.j.cox@durham.ac.uk> wrote:
>> Some variation on this may help:
>>
>> sysuse auto, clear
>> gen blank = .
>> collapse rep78 headroom gear_ratio
>> gen one = 1
>> gen three = 3
>> gen four = 4
>> twoway bar rep78 one || bar headroom three || bar gear four, ///
>> base(0) yla(0/4) ///
>> xla(1 `" "Repair" "record" "' 3 "Headroom" 4 "Gear ratio") legend(off)
>>
>> Nick
>> n.j.cox@durham.ac.uk
>>
>> Friedrich Huebler
>>
>> I am trying to draw a bar graph with a gap between sets of bars, as in
>> the example below. The gap is created with a variable that contains
>> only missing values.
>>
>> sysuse auto, clear
>> gen blank = .
>> #delimit ;
>> graph bar rep78 blank headroom gear_ratio,
>>  showyvars
>>  yvaroptions(relabel(1 "Repair record" 2 " " 3 "Headroom" 4 "Gear
>> ratio"))
>>  legend(off)
>> ;
>>
>> I have two questions about this graph.
>>
>> 1. How can I suppress the drawing of the number 2 under the gap? I
>> tried "" and " " as labels, with no effect.
>> 2. How can I draw the words "Repair" and "record" on top of each other
>> instead of next to each other? I tried different combinations of
>> quotes without success.

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