Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: setting axis scale to maximum value of a variable


From   Tim Evans <Tim.Evans@wmciu.nhs.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: setting axis scale to maximum value of a variable
Date   Mon, 11 Jun 2012 10:03:29 +0100

Hi all,

I have two questions, the first one is, how do I set the formatting of the y axis when graphing twoway so that I don't display any significant figures - i.e I want to show 150 and not 150.00 as I currently have.

The second question is, I am running a loop of graphs on rates that I have generated. However, the scale I set in the twoway line graph may not be appropriate for each version of the graph I generate. So for instance I have 3 age groups 0-49, 50-64 and 64-79, the maximum value for 'crude' is say 100 for 0-49, 300 for 50-64 and 400 for 64-79. Defaulting the y-axis to 400 (as I am currently doing) will make the 0-49 graph look odd as it wont be scaled appropriately. 

Is there a way that I can specify in the options that the y-axis is only scaled up to the nearest 10 of the maximum for each iteration of the loop?

My code is this:

levelsof age_grp, local(levels)
foreach l of local levels {
line crude yydx if surg==2 & age_grp==`l', lpattern("l") || line crude yydx if surg==1 & age_grp==`l',  lpattern("_")|| line crude yydx if surg==99 & age_grp==`l', lpattern(".._..") xaxis(1 2) ,  /*
*/ ylabel(0 (50) 400, gmax angle(horizontal)) /*
*/ xlabel(2001, axis(1)) xtitle("Year", size(small) axis(2)) xtitle("", axis(1)) plotregion(lstyle(none)) /*
*/ ytitle("Rate per 100,000 women", size(small)) title("`: label (age_grp) `l''", size(medsmall)) /*
*/ legend(label(3 "All breast cancer") /*
*/ label(2 "Mastectomy") label(1 "Breast surgery")) /*
*/ legend(region(lstyle(none)) rows(1) size(small) lcolor(none))
}

Best wishes

Tim
_DISCLAIMER:
This email and any attachments hereto contains proprietary information, some or all of which may be confidential or legally privileged. It is for the exclusive use of the intended recipient(s) only. If an addressing or transmission error has misdirected this e-mail and you are not the intended recipient(s), please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail or any attachments, as this may be unlawful.


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index