Search code examples
plottime-seriesstataaxis-labelstimeserieschart

Stata: categorical y-axis in line plot


I have a time series dataset where each data point contains a categorical rating. To use the dataset in regression analysis, I linearly transformed my dataset by replacing each category string with a corresponding number drawn from a linear sequence (say, A = 1, B = 2, C = 3, ..., Z = 26).

However, I would still like to have some plots that depict the development of the rating over time. Ideally, I would want the y-axis to be labeled with the original category, rather than the number I applied in the transformation. Is that possible?

EDIT: The observations are labeled. So, essentially I would like to use the labels, rather than the values on the y-axis.


Solution

  • You could use the value labels:

    tsline var_X, ylabel(1/26, valuelabel)