Producing heatmaps in Stata 14.2 I ran into two problems with . Consider the following MWE:
Problem 1: This seems to be just a programming bug. The code produces the error message :
.
There is a simple fix: run the do-file without defining the local macro ccolor once (* local ccolor ... on line 7). After that one can go back to the initial version and the do-file works as it should.
Problem 2: The figure below shows that the heatmap produces unequally sized areas for the data points. I do not see any reason why the data point (1,1) should be represented with only a quarter of the area compared to data point (2,2). I suggest that the default behavior should be to produce equally sized areas (with the graph starting from 0.5, up to 4.5.
Code:
clear set obs 16 gen x=mod(_n-1,4)+1 gen y=floor((_n-1)/4)+1 gen z=mod(x+y,2) local ccuts ccuts(.1 .2 .3 .4 .5 .6 .7 .8 .9) local ccolor ccolor(black blue green dknavy eggshell ltblue pink emerald cyan white ) twoway contour z y x , `ccuts' `ccolor' heatmap
Code:
cstyles[10].color.setstyle, style(white): class type not found
There is a simple fix: run the do-file without defining the local macro ccolor once (* local ccolor ... on line 7). After that one can go back to the initial version and the do-file works as it should.
Problem 2: The figure below shows that the heatmap produces unequally sized areas for the data points. I do not see any reason why the data point (1,1) should be represented with only a quarter of the area compared to data point (2,2). I suggest that the default behavior should be to produce equally sized areas (with the graph starting from 0.5, up to 4.5.
Comment