Greetings,
Good start of the year colleagues. I am trying to make a heat map. I have 4 variables: 1 string that has the days of the week, 1 categorical that I use to sort the days of the week from Monday to Sunday, another one that where I have the hours of the day and the last one is variable of my interest to graph.
I am using the following code for graphing
#delimit ;
heatplot atropellamiento dia hora,
yscale(noline reverse)
ytitle("")
xtitle("")
ylabel(, nogrid labsize(*0.9) angle(0))
xlabel(0(1)24, labsize(*0.6) nogrid)
color(inferno, reverse)
p(lcolor(black%10) lwidth(*0.15))
cuts(0(10)100)
leg(off)
;
#delimit cr
The doubt that I have is how I can force so that in the yaxis and it appears ordered from Monday to Sunday. I tried to use the numeric variable so that it would be ordered and then label it with the names of the days of the week but the graph gets out of order.
Greetings
Good start of the year colleagues. I am trying to make a heat map. I have 4 variables: 1 string that has the days of the week, 1 categorical that I use to sort the days of the week from Monday to Sunday, another one that where I have the hours of the day and the last one is variable of my interest to graph.
I am using the following code for graphing
#delimit ;
heatplot atropellamiento dia hora,
yscale(noline reverse)
ytitle("")
xtitle("")
ylabel(, nogrid labsize(*0.9) angle(0))
xlabel(0(1)24, labsize(*0.6) nogrid)
color(inferno, reverse)
p(lcolor(black%10) lwidth(*0.15))
cuts(0(10)100)
leg(off)
;
#delimit cr
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str10 dia byte hora int choquecarro float dia_num "Lunes" 0 767 1 "Lunes" 1 473 1 "Lunes" 2 365 1 "Lunes" 3 258 1 "Lunes" 4 221 1 "Lunes" 5 244 1 "Lunes" 6 564 1 "Lunes" 7 1698 1 "Lunes" 8 2333 1 "Lunes" 9 2111 1 "Lunes" 10 1819 1 "Lunes" 11 1690 1 "Lunes" 12 1930 1 "Lunes" 13 1960 1 "Lunes" 14 2473 1 "Lunes" 15 2351 1 "Lunes" 16 2250 1 "Lunes" 17 2150 1 "Lunes" 18 2092 1 "Lunes" 19 1946 1 "Lunes" 20 1639 1 "Lunes" 21 1100 1 "Lunes" 22 784 1 "Lunes" 23 585 1 "Martes" 0 453 2 "Martes" 1 260 2 "Martes" 2 164 2 "Martes" 3 127 2 "Martes" 4 119 2 "Martes" 5 156 2 "Martes" 6 573 2 "Martes" 7 1646 2 "Martes" 8 2641 2 "Martes" 9 2387 2 "Martes" 10 1972 2 "Martes" 11 1813 2 "Martes" 12 1943 2 "Martes" 13 1939 2 "Martes" 14 2435 2 "Martes" 15 2301 2 "Martes" 16 2158 2 "Martes" 17 2093 2 "Martes" 18 2230 2 "Martes" 19 2024 2 "Martes" 20 1657 2 "Martes" 21 1121 2 "Martes" 22 784 2 "Martes" 23 551 2 "Miércoles" 0 598 3 "Miércoles" 1 291 3 "Miércoles" 2 188 3 "Miércoles" 3 156 3 "Miércoles" 4 144 3 "Miércoles" 5 167 3 "Miércoles" 6 552 3 "Miércoles" 7 1775 3 "Miércoles" 8 2615 3 "Miércoles" 9 2086 3 "Miércoles" 10 1902 3 "Miércoles" 11 1710 3 "Miércoles" 12 1850 3 "Miércoles" 13 1990 3 "Miércoles" 14 2333 3 "Miércoles" 15 2323 3 "Miércoles" 16 2097 3 "Miércoles" 17 2128 3 "Miércoles" 18 2171 3 "Miércoles" 19 2027 3 "Miércoles" 20 1680 3 "Miércoles" 21 1119 3 "Miércoles" 22 827 3 "Miércoles" 23 609 3 "Jueves" 0 524 4 "Jueves" 1 320 4 "Jueves" 2 245 4 "Jueves" 3 147 4 "Jueves" 4 142 4 "Jueves" 5 200 4 "Jueves" 6 521 4 "Jueves" 7 1671 4 "Jueves" 8 2415 4 "Jueves" 9 2062 4 "Jueves" 10 1663 4 "Jueves" 11 1666 4 "Jueves" 12 1803 4 "Jueves" 13 1815 4 "Jueves" 14 2353 4 "Jueves" 15 2393 4 "Jueves" 16 2072 4 "Jueves" 17 2061 4 "Jueves" 18 2174 4 "Jueves" 19 1963 4 "Jueves" 20 1808 4 "Jueves" 21 1149 4 "Jueves" 22 896 4 "Jueves" 23 729 4 "Viernes" 0 697 5 "Viernes" 1 441 5 "Viernes" 2 342 5 "Viernes" 3 272 5 end
Greetings
Comment