[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: -graph bar, over()- question and bug report
Friedrich Huebler wrote:
> How can I emphasize some of the groups in a -graph bar, over()-
> graph? I have graphs similar to one produced with these commands:
> . sysuse uslifeexp
> . drop if year>1910
> . graph bar le_w le_b, over(year) stack
> Let's assume I want to emphasize the years 1902 to 1905. As far as I
> know, none of the following ideas can be implemented in Stata.
> - Draw the labels for 1902 to 1905 in a different color.
> This idea is
> my personal favorite but -relabel(# "text")- has no option for
> specifying the color of the text.
> - Add a horizontal line from 1902 to 1905 (horizontal y lines cross
> the entire graph).
> - Add two vertical lines, one to the left of 1902 and one to the
> right of 1905 (vertical lines cannot be added).
> I would appreciate any suggestions for adding emphasis to the years
> 1902 to 1905.
> Now to the bug report. I thought about creating a vertical line with
> the letters I or l but this leads to an error message.
> . graph bar le_w le_b, over(year) stack text(2 18 "I" 2 55 "I")
> invalid syntax
> The same error message appears when the letters i, j, or l are used.
> That resulting graph has only the bars without any labels. I did not
> test the entire alphabet but most other letters appear to
> work. I can
> create a vertical line with the character used to indicate "or" in
> Stata commands but I would rather not use the -text- option because
> the correct coordinates depend on things like legend position and
> size that are not fixed.
As was previously stated, you could get away with some of these options
using -twoway bar-, but then you would lose the ability to stack your bars.
Unfortunately, there aren't any options available with Bar Chart that will
allow you to emphasize a range of data using lines, color of text, etc. I
will forward your request to our developers, and they'll be able to
determine whether or not it would be feasible to add such options.
As for the bug report about the text option in Bar Chart, there does appear
to be an error. The option is designed for use with twoway graphs only, so
you shouldn't be able to use the option with Bar Charts. Bar Chart uses a
categorical x-axis instead of a numeric x-axis. It appears that the only
error is due to Stata allowing any letter or text to be placed in the graph.
In my opinion, there should be a better syntax error when the -text- option
is mistakenly used with a non-twoway graph. I will pass this information on
to our developers as well.
* For searches and help try: