Tabi
Tabi

Reputation: 162

Stata graph with no upper border and margin

I'm trying to plot a combined graph in Stata. I don't find a way to make the upper border line white (it is blue).

Also- how can I delete the margin in the upper and downer part of the graph when using iscale(*.8)? graphregion(margin(zero)) does not work.

Example code:

global graph_path "*change to graph path*"

clear
input a b c
1 3 4 
2 2 3
3 5 6
4 7 4
end

twoway (line b a, sort connect(l) lwidth(thick)) , ///
title("pic1") saving("$graph_path\pic1", replace) ///
yscale(noline) ylabel(#5, noticks angle(0))  graphregion(color(white)) bgcolor(white)

twoway (line c a, sort connect(l) lwidth(thick)) , ///
title("pic1") saving("$graph_path\pic2", replace) ///
yscale(noline) ylabel(#5, noticks angle(0))  graphregion(color(white)) bgcolor(white)

graph combine "$graph_path\pic1" "$graph_path\pic2", rows(1) ycommon xcommon ///
iscale(*.8) fysize(60) graphregion(color(white) margin(zero)) title("Pic 1 + Pic 2") 

graph export "$graph_path\pics.wmf", replace

Upvotes: 3

Views: 2135

Answers (1)

Billy Buchanan
Billy Buchanan

Reputation: 51

You might still need to tweak things a bit, but you should check out:

net inst brewscheme, from("http://wbuchanan.github.io/brewscheme")

I just submitted the newest version to SSC (this is the version listed above), but would allow you to build out a .scheme file that you could use with your calls to the graph commands to reduce a bunch of the coding you're currently doing to get the aesthetics set the way you like. Additionally, the version currently available on the project site generates .theme files which are used internally by brewscheme to separate global (e.g., plot independent) aesthetics from local (e.g., plot specific) aesthetics. So, you could create a .theme file that excludes the upper border and margin with brewtheme and then use brewscheme to generate any number of scheme files that include the graph specific aesthetics that you want. The version available through the GitHub pages site mentioned above also creates versions of your file that simulate the appearance under different types of color sight impairments to make it easier to proof graphs to ensure they are easy to interpret for the widest possible audience.

Upvotes: 2

Related Questions