我在用graph twoway scatter
并添加我自己的ylabels
.
我经常有很长的标签并将它们分成多行。然而当我想要破解的时候却遇到了问题some标签超过两行,但不超过两行。
当我这样做时,单行标签相对于它们的中心是偏离的tick
标记,就好像 Stata 期望它们也有两条线一样。
请参阅下面的简单说明:
sysuse auto, clear
/* This graph has one long label and one short but both are off-center
relative to their tick marks */
twoway scatter length weight, ytitle("") ylabel(220 ///
`" "This one is a very long" "label, broken up" "' 140 "This one is not", ///
ang(horizontal))
/* The order of labels on the graph *does not* appear to matter */
twoway scatter length weight, ytitle("") ylabel(180 ///
`" "This one is a very long" "label, broken up" "' 220 "This one is not", ///
ang(horizontal))
/* But the order in the command *does* appear to matter */
twoway scatter length weight, ytitle("") ylabel(220 ///
"This one is not" 140 `" "This one is a very long" "label, broken up" "', ///
ang(horizontal))
这不是一个大问题,但我多年来一直注意到这个问题,并且知道为什么我的图表会这样表现会很好。
目前还不清楚到底是什么原因导致这种情况,但可以做一个educated guess.
看来如果您更改代码以包含所有strings
in double quotes
,问题就消失了。使用你的玩具示例:
sysuse auto, clear
twoway scatter length weight, name(gr1) ytitle("") ylabel(220 ///
`" "This one is a very long" "label, broken up" "' 140 `" "This one is not" "', ///
ang(horizontal))
twoway scatter length weight, name(gr2) ytitle("") ylabel(180 ///
`" "This one is a very long" "label, broken up" "' 220 `" "This one is not" "', ///
ang(horizontal))
twoway scatter length weight, name(gr3) ytitle("") ylabel(220 ///
`" "This one is not" "' 140 `" "This one is a very long" "label, broken up" "', ///
ang(horizontal))
这可能与内部解析代码的方式有关,并表明 Stata 期望第二个string
与第一个引用的数量相同。
只有 StataCorp 可以明确回答您的问题,但希望上面的示例能为您提供有关正在发生的情况的线索。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)