Statalist


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

st: RE: left alignment of value labels in bar graph too little


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: left alignment of value labels in bar graph too little
Date   Thu, 11 Dec 2008 23:05:27 -0000

Even for frequent graph users postings like this impose the burden of creating an analogue with another dataset to see exactly what the issue is. Simply, we don't have your data. 

With the auto data, this command shows your difficulty: 

graph bar turn trunk mpg ,  over(rep78) bargap(-30) nofill blabel(bar, j(left) color(white) format(%9.1f) size(2)position(center)) percentages

My main reaction is that your problem is self-inflicted, i.e. you make the bars overlap and then necessarily have less space to put the label. 

You could use the Graph Editor to change the position of the -blabel()- to west. That does not seem to be available interactively and I am not clear that it improves things overall. 

With the auto example a retreat to 

graph bar turn trunk mpg ,  over(rep78) nofill blabel(bar, color(white) format(%9.1f) size(2) position(center)) percentages

produces a simpler and perfectly readable display. There's also scope for improving it by simplifying the legend. You can also increase -size()- above 2. 

Nick 
[email protected] 

René Geppert

the simplified graph code looks as follows:
graph bar l1lfvl l2lfvl l3lfvl if early == 1,  over(counter) bargap(-30) 
nofill blabel(bar, j(left) color(white) format(%9.1f) size(2) 
position(center)) percentages

the counter runs from 1 to 6, that is the graph comprises 6*3=18 bars

because of the negative bar gap the (white) value labels inside each 
first bar partially overlap to the second bar
for that reason i wanted to left-align the blabels which does work with 
the justification (j(left)) option, but since bars are quite small the 
result is marginal and not satisfactory because the left shift is too little
is there any way to even more left shift the value labels?
(i dont want to reduce the bargap or further reduce the lavel size, that 
is below 2)

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index