Dear Statalist community,
I have two questions related to the legend of contour plots:
1) Legend width
help clegend_option lists both height() and width() as suboptions. However, only width() seems to affect the rendition of the legend in the example below ("default" and "short" are identical).
What am I missing? Compressing the legend by adding margins does the job, but it seems there should be a native solution.
2) Legend positioning
Am I right to assume that there is no way of flipping the clegend (similar to the ramp(bottom) option in Ben Jann's heatplot ado)? My goal ist to add a horizontal color ramp at the bottom of a twoway graph. The closest I got is using contourline as a workaround.
(dont't mind the ugly graph; it's all about the legend)
I noticed that Stata 18 offers the colorvar() option but I haven't seen any horizontal color ramps in the official documentation there either. Any ideas and comments are appreciated!
I am using Stata 17 on Windows 10.
I have two questions related to the legend of contour plots:
1) Legend width
help clegend_option lists both height() and width() as suboptions. However, only width() seems to affect the rendition of the legend in the example below ("default" and "short" are identical).
Code:
* Setup clear all macro drop _all version 17 sysuse sandstone.dta, clear * Contour plots twoway contour depth northing easting, name(default) twoway contour depth northing easting, name(narrow) clegend(width(*0.5)) twoway contour depth northing easting, name(short) clegend(height(*0.5)) twoway contour depth northing easting, name(quickfix) clegend(region(margin(t=10 b=10)))
2) Legend positioning
Am I right to assume that there is no way of flipping the clegend (similar to the ramp(bottom) option in Ben Jann's heatplot ado)? My goal ist to add a horizontal color ramp at the bottom of a twoway graph. The closest I got is using contourline as a workaround.
Code:
sysuse sandstone.dta, clear #delimit ; twoway contourline depth northing easting, colorlines crule(intensity) ecolor(dknavy) reversekey ccuts(7500(100)8000) format(%0.0f) graphregion(color(white)) clwidth(vvvthick vvvthick vvvthick vvvthick vvvthick vvvthick) plegend(cols(6) pos(6) stack colgap(0) region(lcolor(none))) ; #delimit cr
I noticed that Stata 18 offers the colorvar() option but I haven't seen any horizontal color ramps in the official documentation there either. Any ideas and comments are appreciated!
I am using Stata 17 on Windows 10.
Comment