Reputation: 222
Without using the graph editor, I would like to know if the there is a way (code-wise) to customize with string characters the tick labels in your output graph. Say, for instance, I have four ticks in my x-axis (the following years): 2010, 2011, 2012 and 2013. If I wanted to add a character such as "#" in each year of the x-axis (e.g. each year would look something like "2010#" in the x-axis), would it be possible to do it without using the graph editor?
Upvotes: 0
Views: 3409
Reputation: 37208
Following @Roberto Ferrer's helpful comment, here is his second method based on downloading mylabels
using ssc inst mylabels
:
. webuse grunfeld, clear
. su y
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
year | 200 1944.5 5.780751 1935 1954
. mylabels 1935(4)1955, suffix(#) myscale(@) local(lbl)
1935 "1935#" 1939 "1939#" 1943 "1943#" 1947 "1947#" 1951 "1951#" 1955 "1955#"
. xtline invest, overlay xla(`lbl')
It's not especially time- or effort-saving interactively, but could be built into programs or do-files.
Upvotes: 1