2016-11-15 31 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

您可以通過一些努力閱讀您目前的數據,但我認爲工程太像無趣的辛勤工作。 (如果它變得不真實,我會刪除這個評論。)(另外,爲什麼我的答案不是你想要翻譯你的變量名稱?) –