Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65044

Manipulating Y axis using "stripplot" - getting rid of extra space/controlling margins

$
0
0
Hi all,

I've been Googling an answer to this for FAR too long and am wondering if anyone can help.

I'm trying to graph a series of box plots using "stripplot" on STATA/IC 13.1 . I am plotting the interquartile range of birth weight (in grams) by year with 3 other line graphs overlaid:
  • smoothed lowess line for the full sample over time
  • smoothed lowess line for those in the 10th birth weight centile over time
  • smoothed lowess line for those in the 90th birth weight centile over time
This is my code:

Code:
 
stripplot birthweight, over(year) vertical ///
box(bfcolor(gs14) barw(0.2)) iqr(1.5) ms(none) ///
addplot(lowess birthweight year, lcolor(black)  yscale(range(1500 4500)) ylabel(1500(500)4500) || ///
lowess tenth1 year,  yscale(range(1500 4500)) ylabel(1500(500)4500) || ///
lowess ninety1 year,  yscale(range(1500 4500)) ylabel(1500(500)4500))
I've specified the yscale and ylabel above because I want to "zoom into" these values and not extend the Y axis to the full range of underlying birth weight data (which go from a min of ~450g to max of ~4700g).

After manually editing the size of the X/Y axis labels for clarity, my graph looks like this:
Array

::Please ignore the fact that the colours are terrible!:: All I want to do is get rid of that huge empty space at the bottom of the Y Axis and just zoom into the relevant part of the graph. It seems as though the margins are still adjusted to the default min/max values of the underlying raw data (mainly at the bottom/lower values of the Y axis).

Please can anyone please help me figure out how to manipulate these margins? I don't understand why the graph is produced this way.

Than you!

Catherine

Viewing all articles
Browse latest Browse all 65044

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>