I'm getting some behavior that I don't expect regarding the formatting of axis labels. In certain circumstances, the axis labels are pretty round numbers, and in other circumstances, they are ugly almost-round numbers that are shifted by what appears to be a floating-point amount.
Code:
pause on clear input x 0.5 1 end hist x // Axis labels are pretty pause // Enter q to continue execution format %65.0g x hist x // Axis labels are ugly pause format %9.0g x hist x // Axis labels are pretty again pause label define elephant .e "Missing because an elephant sat on it and it got kind of squished" label value x elephant // format of x becomes %65.0g automatically hist x // Axis labels are ugly again pause format %9.0g x hist x // Axis labels are ugly still pause label value x // Remove the value label hist x // Axis labels are pretty again pause label value x elephant, nofix // nofix prevents format of x from changing hist x // Axis labels are ugly again pause off
- In every case, Stata should be smart enough to figure out that the axis labels should be displayed as ".2" etc. After all, Stata is the one choosing these labels. Let's leave that to one side.
- What is it about the presence of a value label that causes the axis label formatting to fail, even when the variable format is "correct"?
- As a workaround, is there a way of coercing axis label formatting to work properly without dropping the value label?
Comment