![]() ![]() *A second, minor question is that I do not understand why the x-axis gets an elipsis (.) when I add the scatteri plot. I have tried adding axis(2) to the text box as an additional argument, but this option is apparently not allowed. It seems better to be able to attach the text to the line using the second y-axis gridpoints. Of course, I could manually determine this value for the histogram (as I did in this example), but I plan to create a set of these graphs via a loop, such that there are a dozen or so panels. The corresponding lines would instead be: text(1 `median' `"median = $`=string(`median',"%6.2f")'"', /// saving() option added (requested by Glenn Harrison). Instead of "0.08" which gets my text into the correct location, I would like to use "1", as this is the maximum value of the second y-axis. xline() option added to allow users to plot reference lines on the x-axis (requested by Glenn Harrison). This is the reason I used the second y-axis in the first place. This produces the desired graph (for the most part*):Īt issue is that I do not know the height of the histogram beforehand. > What I'd really like is for the numerical x labels to be there (stata default is fine) but with these additional vertical lines being labeled somewhere, there is space on the graph but I can't figure out how to do it. Text(0.08 `median' `"median = $`=string(`median',"%6.2f")'"', /// I can tell it to put some of the tick marks back on by writing xlabel ( 25 50 '2 Stars'), but that also looks strange. Scatteri 0 `median' 1 `median', recast(line) yaxis(2) /// Twoway hist mpg, start(10) width(5) || /// Here is an example of my issue: sysuse auto However, I cannot seem to add text to this line using the second y-axis coordinates (it instead uses the first y-axis coordinates, even though the object it is labeling is on the second y-axis). To fix this, I am using scatteri with coordinates.īecause I do not know the height of the histogram beforehand, I set the scatteri plot to use a separate y-axis, which I have hidden. I cannot use xline() because the line falls behind the histogram, rather than on top of it. I have a plot of a histogram, to which I would like to add the median. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |