Reputation: 4615
In Stata, the following code produces a contour plot:
sysuse auto, clear
twoway (contour headroom mpg price), legend(on)
The plot looks as follows:
How do I change the legend to automatically format its labels as 1.0
, 2.0
etc.?
I would like to do this without having to manually create labels and pass them to the legend
option.
In my actual application, I'm trying to get this to work for a map that comes from the spmap
command, but it's difficult to provide a minimal working example with that command.
Upvotes: 1
Views: 943
Reputation:
It looks like you want to re-format the numbering in the clegend
of the contour plot (as opposed to the 'traditional' legend
).
In this case, you just need to specify the zlabel
option and the required format:
sysuse auto, clear
twoway contour headroom mpg price, zlabel(#5, format(%2.1f))
This will produce the desired output:
Upvotes: 1