First time statalist user here. I am studying the supply and demand of fishing poles in warehouses by quarter and I am trying to replicate the graph below made in Excel: Basically, a stacked bar graph showing the percentages of the fishing pole availability categories overlaid with a line graph of the total number of customers buying the poles every quarter. Array
The main problem is that I cannot figure out how to do the overlaying of the two graph types in stata either using catplot or tabplot. Would anyone have encountered a similar problem and would have any advice to offer? is it actually possible to do the overlay? I've been stuck on this for days and any help would be appreciated.
I produced the catplot with the code below.
Code:
catplot method_available quarter [aw=normwt] if ma==1, /// percent (quarter) recast (bar) blabel(bar, position(center) format(%3.1f) size(2)) /// var1opts(label(labsize(small))) /// var2opts(label(labsize(small)) relabel(`r(relabel)')) /// ytitle("Percent of facilities offering FP", size(small)) /// title("Public" /// , span size(medium)) /// intensity(25) /// asyvars stack /// bar(1, color(blue) fintensity(inten80)) /// bar(2, color(blue) fintensity(inten60)) /// bar(3, color(red) fintensity(inten90)) /// bar(4, color(orange) fintensity(inten60)) /// bar(5, color(navy) fintensity(inten80)) /// legend(off) name(public, replace) catplot method_available quarter [aw=normwt] if ma==2, /// percent (quarter) recast (bar) blabel(bar, position(center) format(%3.1f) size(2)) /// var1opts(label(labsize(small))) /// var2opts(label(labsize(small)) relabel(`r(relabel)')) /// ytitle("Percent of facilities offering FP", size(small)) /// title("Private" /// , span size(medium)) /// intensity(25) /// asyvars stack /// yscale (off) /// bar(1, color(blue) fintensity(inten80)) /// bar(2, color(blue) fintensity(inten60)) /// bar(3, color(red) fintensity(inten90)) /// bar(4, color(orange) fintensity(inten60)) /// bar(5, color(navy) fintensity(inten80)) /// legend(rows(1) stack size(small) /// order(1 "Does not" "Provide method" 2 "Currently in stock and" "no stock out last 3 months" 3 "Provides method" "and confirmed in stock" /// 4 "Provides method but" "out of stock at visit") /// symplacement(center) /// title(Method provision categories, size(small))) name(private, replace) grc1leg public private
The tabplot was produced using the code below.
Code:
****TABPLOT local spaces = 3 * uchar(9) tabplot method_available quarter, by(ma, compact note("% by method and quarter", size(small))) /// percent(method_available quarter) showval(offset(0.2)) /// graphregion(color(white)) ytitle("") xtitle("`spaces'Quarter", size(small)) /// xsc(titlegap(*8)) subtitle(, fcolor(none)) /// separate(method_available) barall(blcolor(black)) bar1(bfcolor(orange)) bar2(bfcolor(blue)) bar3(bfcolor(purple)) bar4(bfcolor(red))
0 Response to Overlaying a line graph over a catplot or tabplot graph
Post a Comment