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

From |
vwiggins@stata.com (Vince Wiggins, StataCorp) |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: graph added text behaving strangely |

Date |
Mon, 29 Oct 2007 15:16:51 -0500 |

Dan Weitzenfeld <dan.weitzenfeld@emsense.com> writes that when he adds three pieces of text to a horizontal bar chart and keeps the first position constant for each piece of text, the pieces of text are not on a horizontal line. Dan provides the following code, which reproduces the problem > . sysuse auto,clear > . graph hbar mpg, over(head) > text( 20 25 "20_25" 20 15 "20_15" 20 10 "20_10") This is a bug. It will be fixed in a future update. I have one further comment and one easy workaround. Comment ------- There is one nuance to horizontal bar charts, and that nuance means that Dan will still have to make one small change to his expectations. When you specify coordinates on a horizontal bar graph (including those for the location of added text), you do so as though the graph were still horizontal. Put another way, it is the horizontal axis on a horizontal bar graph that is called the y axis. So, the y-axis is always the axis that measures the height of the bars, regardless of whether the graph is vertical or horizontal. Why? So that you can switch a standard vertical bar chart to a horizontal bar chart without having to reverse any coordinates that you specify on the command. At one time, we even considered calling the "y" axis the "scale" axis on bar charts to make clear that it could switch directions. So, when the fix is in Dan should flip each of his coordinates and code. . graph hbar mpg, over(head) text(25 20 "20_25" 15 20 "20_15" 10 20 "20_10") if he wants his text all in a horizontal row. If he wants a vertical row, he should leave the -text()- option as it is. Workaround ---------- The bug with the option -text()- on horizontal bar charts is that it is only handling the first coordinate correctly. That is why Dan's text does not fall on a line. Because the -text()- option can be repeated, Dan can type, . graph hbar mpg, over(head) text(25 20 "20_25") text(15 20 "20_15") text(10 20 "20_10") to get text aligned horizontally. Or, he can type, . graph hbar mpg, over(head) text(20 25 "20_25") text(20 15 "20_15") text(20 10 "20_10") to align the text vertically. -- Vince vwiggins@stata.com * * 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: -clogit-, -asclogit- and marginal effects** - Next by Date:
**RE: st: variable names from variable window to command window (and cutting from the command window)** - Previous by thread:
**Re: st: graph added text behaving strangely** - Next by thread:
**st: Infile errors** - Index(es):

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