Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Stata 在多条线上断开时轴标签偏离中心_Stata - Fatal编程技术网

Stata 在多条线上断开时轴标签偏离中心

Stata 在多条线上断开时轴标签偏离中心,stata,Stata,我正在使用图形双向散点并添加我自己的ylabel 我经常有很长的标签,并把它们分成多行。但是,当我想要在两行上断开一些标签,而不是其他标签时,我会遇到一个问题 当我这样做时,单行标签相对于它们的勾号标记偏离中心,好像Stata希望它们也有两行 请参见下面的简单说明: sysuse auto, clear /* This graph has one long label and one short but both are off-center relative to their tick m

我正在使用
图形双向散点
并添加我自己的
ylabel

我经常有很长的标签,并把它们分成多行。但是,当我想要在两行上断开一些标签,而不是其他标签时,我会遇到一个问题

当我这样做时,单行标签相对于它们的
勾号
标记偏离中心,好像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))

这不是一个大问题,但我已经注意到多年了,知道我的图形为什么会这样会很好

目前尚不清楚究竟是什么原因导致了这一现象,但我们可以做出有根据的猜测

如果您将代码更改为在
双引号中包含所有
字符串
,则问题将消失。使用您的玩具示例:

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希望第二个
字符串
的引号数与第一个相同


只有StataCorp可以肯定地回答您的问题,但希望上面的例子能为您提供一个关于发生了什么的线索。

很好的回答!一旦Stata遇到双引号标签,它必须以类似的方式解释以下所有内容,因为在此版本中:双向分散长度权重,ytitle(“”)ylabel(160“短标签1”180“这是一个很长的”标签,分解为“'220”短标签2”,ang(水平))第一个短标签正确居中,而最后一个短标签没有居中,这可能是因为它紧跟在双引号长标签之后,而长标签是故意在线条上打断的。谢谢你的回答,自从我问起,这个问题就一直困扰着我!