Hello,
I have a neat little graph showing each day for each participant in my study. I have created this graph using the following code (you can run using dataex data below). I am having trouble doing something simple: limiting the x axis to 180, and including tick marks on the x axis for every 10 days. I can easily do this in the graph editor by setting the range from 0 to 180 and the delta to 10 but can't figure out how to add this in the code. I tried (as you can see below) to include the code xsc(range(0 180)) but the x axis is still showing 0-200. Hopefully I'm just missing something small?
Thank you!
Sarah
twoway (rbar idreset low2 day if type==0, color(blue)) ///
(rbar idreset low2 day if type==1, color(green)) ///
(rbar idreset low2 day if (type==2|type==7), color(purple)) ///
(rbar idreset low2 day if type==3, color(black)) ///
(rbar idreset low2 day if (type==6|type==4), color(yellow)) ///
,xsc(range(0 180)) legend(order(1 "No weight transmission" 2 "Weight transmission" 3 "Hospitalized" ///
4 "Deceased" 5 "ED Visit")) ///
title("Types of study days for participants-Group 2", span) ytitle("Participant") xtitle("Day")
I have a neat little graph showing each day for each participant in my study. I have created this graph using the following code (you can run using dataex data below). I am having trouble doing something simple: limiting the x axis to 180, and including tick marks on the x axis for every 10 days. I can easily do this in the graph editor by setting the range from 0 to 180 and the delta to 10 but can't figure out how to add this in the code. I tried (as you can see below) to include the code xsc(range(0 180)) but the x axis is still showing 0-200. Hopefully I'm just missing something small?
Thank you!
Sarah
twoway (rbar idreset low2 day if type==0, color(blue)) ///
(rbar idreset low2 day if type==1, color(green)) ///
(rbar idreset low2 day if (type==2|type==7), color(purple)) ///
(rbar idreset low2 day if type==3, color(black)) ///
(rbar idreset low2 day if (type==6|type==4), color(yellow)) ///
,xsc(range(0 180)) legend(order(1 "No weight transmission" 2 "Weight transmission" 3 "Hospitalized" ///
4 "Deceased" 5 "ED Visit")) ///
title("Types of study days for participants-Group 2", span) ytitle("Participant") xtitle("Day")
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float low2 int day double type float idreset 0 1 0 1 0 2 0 1 0 3 6 1 0 4 0 1 0 5 0 1 0 6 0 1 0 7 0 1 0 8 0 1 0 9 0 1 0 10 0 1 0 11 1 1 0 12 0 1 0 13 0 1 0 14 0 1 0 15 0 1 0 16 0 1 0 17 0 1 0 18 0 1 0 19 1 1 0 20 0 1 0 21 0 1 0 22 0 1 0 23 0 1 0 24 6 1 0 25 0 1 0 26 0 1 0 27 2 1 0 28 2 1 0 29 2 1 0 30 2 1 0 31 2 1 0 32 0 1 0 33 0 1 0 34 0 1 0 35 0 1 0 36 1 1 0 37 1 1 0 38 0 1 0 39 1 1 0 40 0 1 0 41 0 1 0 42 0 1 0 43 0 1 0 44 0 1 0 45 0 1 0 46 0 1 0 47 0 1 0 48 0 1 0 49 0 1 0 50 0 1 0 51 0 1 0 52 0 1 0 53 0 1 0 54 0 1 0 55 0 1 0 56 0 1 0 57 0 1 0 58 6 1 0 59 0 1 0 60 0 1 0 61 2 1 0 62 2 1 0 63 2 1 0 64 2 1 0 65 2 1 0 66 2 1 0 67 2 1 0 68 2 1 0 69 2 1 0 70 2 1 0 71 2 1 0 72 2 1 0 73 2 1 0 74 2 1 0 75 2 1 0 76 2 1 0 77 2 1 0 78 2 1 0 79 2 1 0 80 2 1 0 81 2 1 0 82 2 1 0 83 2 1 0 84 0 1 0 85 0 1 0 86 0 1 0 87 0 1 0 88 0 1 0 89 0 1 0 90 0 1 0 91 0 1 0 92 0 1 0 93 3 1 0 94 3 1 0 95 3 1 0 96 3 1 0 97 3 1 0 98 3 1 0 99 3 1 0 100 3 1 end
Comment