2016-11-15 149 views
-2

有谁知道的解决方法,在Stata的水平直方图将在铁栏上的标签?在帮助文件中,它说水平和加标签命令不会一起工作,但我希望有一个很好的方法来做到这一点!任何见解将不胜感激!栏标签添加到水平直方图在Stata

我的数据是这样的: con_physical

Difficult to FINANCE equipment 
Difficult to FINANCE equipment 
Difficult to find premises CONNECTED TO SERVICES 
Difficult to find premises in an optimal LOCATION 
Insufficient supply of WATER 
Difficult to FINANCE equipment 
Difficult to FINANCE equipment 
Difficult to find premises in an optimal LOCATION 
Difficult to FINANCE equipment 
Low level of AUTOMATION 
Difficult to FINANCE equipment 
Difficult to FINANCE equipment 
Difficult to FINANCE equipment 
Difficult to FINANCE equipment 
Unreliable supply of ELECTRICITY 
Difficult to FINANCE equipment 
Unreliable supply of ELECTRICITY 
Difficult to FINANCE equipment 
Difficult to FINANCE equipment 
Difficult to find premises CONNECTED TO SERVICES 
Difficult to FINANCE equipment 
Difficult to FINANCE equipment 
Difficult to find premises CONNECTED TO SERVICES 
Difficult to find premises CONNECTED TO SERVICES 
Difficult to FINANCE equipment 
Unreliable supply of ELECTRICITY 
Difficult to find premises in an optimal LOCATION 
Difficult to FINANCE equipment 
Difficult to find premises CONNECTED TO SERVICES 
Low level of AUTOMATION 
Difficult to FINANCE equipment 
Difficult to find premises that are not in good CONDITION 
Difficult to FINANCE equipment 
Difficult to FINANCE equipment 
Difficult to FINANCE equipment 
Difficult to FINANCE equipment 
Difficult to FINANCE equipment 
Difficult to FINANCE equipment 
Difficult to FINANCE equipment 
Difficult to FINANCE equipment 
Difficult to FINANCE equipment 
Difficult to FINANCE equipment 
Difficult to FINANCE equipment 
Difficult to FINANCE equipment 
Difficult to find premises in an optimal LOCATION 
Difficult to find premises that are not in good CONDITION 
Difficult to find premises that are not in good CONDITION 
Difficult to find premises CONNECTED TO SERVICES 
Difficult to find premises that are not in good CONDITION 
Low level of AUTOMATION 
Low level of AUTOMATION 
Difficult to find premises CONNECTED TO SERVICES 
Unreliable supply of ELECTRICITY 
Low level of AUTOMATION 
Low level of AUTOMATION 
Low level of AUTOMATION 
Difficult to find premises in an optimal LOCATION 
Low level of AUTOMATION 
Difficult to find premises CONNECTED TO SERVICES 
Difficult to FINANCE equipment 

我的代码是

hist con_physical, addlabels title("Biggest Physical Resource Constraint", size(small)) xtitle("Percent of Sample") ytitle("") horizontal discrete percent  bcolor(navy) yla(2/8, valuelabel labsize(vsmall) angle(0)) 

产生这种

回答

0

你不提供重复的例子。有关指导,请参阅https://stackoverflow.com/help/mcve。为什么会出现三个(而且只有三个)标签,以及它们与直方图之间的关系不清楚,而无法访问您的数据。

我不会用histogram这里作为首选。对于拥有自己的价值标签的类别,graph hbar在大多数方面更为灵活。

这个例子展示了一些代码技术,将在您的工作的Stata:

sysuse auto, clear 
graph hbar, over(rep78) blabel(total, format(%2.1f) pos(base)) bar(1, bfcolor(none)) 
more 
contract rep78 
graph hbar (asis) _freq, over(rep78) blabel(total, pos(base)) bar(1, bfcolor(none)) 

在这个例子中,没有价值的标签,但如果他们存在,他们将被显示。

顺便说一句,没有任何明显的排序,以您的类别使它成为一个可怜的图很多的标准。从最频繁到最不重要的订单是一个明显的可能性。

+0

谢谢,尼克!我必须承认,我对于stackoverflow相当新,所以我不确定附加数据的最佳方式。我尝试添加来自变量的值,我试图创建直方图,但让我知道,如果这不是你想到的! – yogz123

+0

对于Stata问题,您需要任何人都可以读取的示例数据集(例如,使用'sysuse'或'webuse')或示例提供的自包含数据集。 'ssc inst dataex'为后者安装专用命令。 –

+0

您可以通过一些努力阅读您目前的数据,但我认为工程太像无趣的辛勤工作。 (如果它变得不真实,我会删除这个评论。)(另外,为什么我的答案不是你想要翻译你的变量名称?) –