Hi everyone,
I've come to ask a rather general question, following the excellent suggestion provided by Maarten Buis in a post to which he replied and advice me to use the -twoway spike- command for these type of data.
How can I "zoom in", if I can call it that, on the period I'm interested in (i.e. more or less from 0 to 25,000) and not take the whole scale on the x-axis please?
Here's the code I've written (I'm obviously open to any suggestions for improving my code, thank you).
Sorry Nick Cox, I have still to change my x-axis label to "Contracted Powers (in kW)"...

Nice continuation,
Michael
I've come to ask a rather general question, following the excellent suggestion provided by Maarten Buis in a post to which he replied and advice me to use the -twoway spike- command for these type of data.
How can I "zoom in", if I can call it that, on the period I'm interested in (i.e. more or less from 0 to 25,000) and not take the whole scale on the x-axis please?
Here's the code I've written (I'm obviously open to any suggestions for improving my code, thank you).
Code:
forvalues j = 1/2 { bys power_p`j' : egen count_p`j' = count(power_p`j') if tariff_2 replace count_p`j' = . if count_p`j' == 0 } preserve bys power_p1 power_p2: keep if (_n==1) // First Period # delimit; twoway spike count_p1 power_p1, lwidth(thick) lcolor(green%25) ytitle("No. of Households", orient(horizontal)) ylabel(, nogrid format(%9.0fc)) xtitle("Contracted Power (in Watts)") subtitle("{bf}1{sup:st} Period", pos(11) size(2)) scheme(white_w3d) legend(off) name(distribution_period_p1, replace) ; # delimit cr // Second Period # delimit; twoway spike count_p2 power_p2, lwidth(thick) lcolor(blue%10) ytitle("No. of Households", orient(horizontal)) ylabel(, nogrid format(%9.0fc)) xtitle("Contracted Power (in Watts)") //xlabel(0(5000)25000, labsize(tiny) alternate nogrid format(%9.0fc)) subtitle("{bf}2{sup:nd} Period", pos(11) size(2)) scheme(white_w3d) legend(off) name(distribution_period_p2, replace) ; # delimit cr graph combine distribution_period_p1 distribution_period_p2, /// cols(1) ycommon title("{bf}Households - Distribution of Contracted Powers on:", pos(11) size(2.75)) /// scheme(white_w3d) name(distribution_power_p1_p2, replace) graph export "../figures/hist_cont_powers_1st_2nd_Period.png", replace graph export "../figures/hist_cont_powers_1st_2nd_Period.pdf", replace restore
Nice continuation,
Michael
Comment