haklion.blogg.se

Rename x axis labels stata
Rename x axis labels stata







rename x axis labels stata

Over(sat, label(labsize(small)) relabel(`r(relabel)')) ///

rename x axis labels stata

You only need to run this once-don't put it in a research do file that you'll run over and over. (The relabel() option allows you to set category labels to whatever you want without setting value labels for the variable, but using value labels is a good practice for many reasons.) You can get splitvallabels by running: On the other hand, an elegant command called splitvallabels by Nick Winter and Ben Jann will take value labels, split them into multiple lines, and make them available as an `r(relabel)' macro in a form the relabel() option can understand. One good solution would be to use a shorter label. We're getting much closer, but the label "Neither Satisfied nor Dissatisfied" is still being truncated. Title("In general, how satisfied are you with your job?" /// Ytitle("Percent of Respondents", size(small)) /// You could also split the title into multiple lines by putting each line in its own set of quotes, but that won't be necessary here.Įach of the new options goes inside the option for the thing it controls. Reduce the size of the title using the size(medium) option.Allow the title to use the space above the axis labels (and be centered across the entire space) using the span option.Reduce the size of the y axis title using the size(small) option.Reduce the size of the category labels using the label(labsize(small)) option.Now the problem is that the text doesn't fit in the graph. Title("In general, how satisfied are you with your job?") We'll also bold the new or changed parts of each command. For this article, we'll put just one option per line, though some options will soon take more than one line. Stata graph commands often get long you can make them more readable by splitting them across multiple lines if you use /// to tell Stata the command continues on the next line. Without quotes, Stata will think you're trying to set title options. The title text doesn't always need to go in quotes, but this one does because it contains a comma. For graphs describing surveys, the question text is often a useful title. This graph is also in dire need of an overall title, which can be added using the title() option. Note that this axis will be horizontal since you're now making a horizontal graph, but it's still referred to as the y axis. Make it more clear with a ytitle() option. You can fix this problem easily and naturally by making the whole graph horizontal rather than vertical. The categories are labeled using the value labels of the sat variable, but they're unreadable because they overlap. Unfortunately, the result is not very satisfactory: By default it will tell you the percentage of observations that fall in each category. The graph bar command tell Stata you want to make a bar graph, and the over() option tells it which variable defines the categories to be described. Begin with the sat variable (job satisfaction) and the most basic bar graph: The most basic task of a bar graph is to help you understand the distribution of a single categorical variable. female: a binary variable which is 1 if the respondent is female and 0 if the respondent is male.It is 0 if the respondent said they were likely to leave and 1 otherwise.

rename x axis labels stata

  • stay: a binary variable based on leave.
  • leave: responses to the question "How likely are you to leave your job in the next year?" on a five-point scale ranging from "Very Likely" to "Very Unlikely.".
  • eng: a numeric measure of employee engagement from 1 to 100.
  • sat: responses to the question "In general, how satisfied are you with your job?" on a five-point scale ranging from "Very Dissatisfied" to "Very Satisfied.".
  • It contains fictional data with 1,000 observations and four variables: You can obtain the data by typing, or more likely copying and pasting, the following in a do file: SSCC's statistical consultants have been asked to analyze several workplace surveys in recent years, so the example data we'll use has that theme (much of this article came out of our efforts to find ways to present our results to very busy leaders).

    #RENAME X AXIS LABELS STATA HOW TO#

    This article will show you how to make a variety of useful bar graphs using Stata. They can be understood at a glance by both technical and non-technical audiences, and often tell you much more than summary statistics will.

    rename x axis labels stata

    Bar graphs are simple but powerful (or rather, powerful because they are simple) tools for conveying information.









    Rename x axis labels stata