Statalist


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

RE: st: Get rid of thin gray lines in graphs


From   Howard Lempel <HLempel@brookings.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Get rid of thin gray lines in graphs
Date   Mon, 23 Feb 2009 12:26:25 -0500

Friedrich,

I also realized that I use the -grc1leg- command to combine my graphs.  This command is available using -findit grc1leg- (i.e. oneleg).

Good idea.  I am trying to create a scheme as you suggested and will report back.  For now, here is the problem using the auto dataset:

sysuse auto

*Create graph1
twoway (hist price if foreign, percent lwidth(medthick) width(3000) start(0) fcolor(none) lcolor(black)) ///
	(hist price if !foreign, percent lwidth(vvthin) width(3000) start(0) fcolor(gs9) lcolor(gs7) barwidth(1200)) ///
	, legend(label(1 "foreign") label(2 "domestic") symysize(*.25) symxsize(*.25) size(tiny) width(22) forcesize) ///
	xtitle("price") graphregion(lcolor(none) ilcolor(none) fcolor(white) ifcolor(white) lwidth(thick)) plotregion(lcolor(none) ilcolor(none) style(none) lwidth(thick)) ///
	title("Distribution of price by foreign", fcolor(white) lcolor(white))  xline(152500, lcolor(black) lpattern(shortdash)) ///
	ylabel(, angle(horizontal) nogrid) bgcolor(white) note("this is my note", size(small)) name(graph1, replace)

*create graph2
twoway (hist price if foreign, percent lwidth(medthick) width(3000) start(0) fcolor(none) lcolor(black)) ///
	(hist price if !foreign, percent lwidth(vvthin) width(3000) start(0) fcolor(gs9) lcolor(gs7) barwidth(1200)) ///
	, legend(label(1 "foreign") label(2 "domestic") symysize(*.25) symxsize(*.25) size(tiny) width(22) forcesize) ///
	xtitle("price") graphregion(lcolor(none) ilcolor(none) fcolor(white) ifcolor(white) lwidth(thick)) plotregion(lcolor(none) ilcolor(none) style(none) lwidth(thick)) ///
	title("Distribution of price by foreign", fcolor(white) lcolor(white))  xline(152500, lcolor(black) lpattern(shortdash)) ///
	ylabel(, angle(horizontal) nogrid) bgcolor(white) note("this is my note", size(small)) name(graph2, replace)

*create combination
grc1leg graph1 graph2, name(combo1) xsize(8.4) ysize(6) title("two graphs", size(small)) altshrink note("combonote", size(tiny)) ///
	graphregion(lcolor(none) ilcolor(none) fcolor(white) ifcolor(white)) ///
	plotregion(lcolor(none) ilcolor(none) style(none))

Thanks.
Howie

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Friedrich Huebler
Sent: Monday, February 23, 2009 12:10 PM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Get rid of thin gray lines in graphs

Howie,

It would be helpful if you could reproduce the problem with one of the
datasets shipped with Stata. I used to have unwanted lines in my
graphs and was able to suppress them by creating a scheme with the
following line:

color background white

Friedrich

On Mon, Feb 23, 2009 at 12:00 PM, Howard Lempel <HLempel@brookings.edu> wrote:
> Hello all,
>
> I'm using -graph combine- to create a figure with four graphs.  I'd like all elements of the background to be white.  I've been able to make the plot region and graph region white, but thin lines remain.  There are unwanted lines in the individual graphs and in the combined graph.  I'd like help removing these lines.  I'm using Stata 10 for windows.  The positions of the lines are described below.
>
> 1) Individual graphs
> In the individual graphs have unwanted lines that form a box with its borders just to the left of the y axis title, just under my note, just to the right of the end of the x axis, and just above my title.  There is a second box that encloses this first box.
>
> 2) Combined figure
> There are additional unwanted lines in the combined figure.  These are similar to the lines in the individual graphs.  There is one box with an upper boundary just above the combined title and a lower boundary just below the combined note.  There is another box that encloses the first box.
>
> As you'll see in my code below, I have tried setting the color of the plotregion and graphregion to white, setting the undocumented -bgcolor- option to white, and increasing the -lwidth- in my graphregion.  I've also tried adding the -fcolor(white)- option to my title, with no luck.  I've tried the suggestions in the following threads:
>
> http://www.stata.com/statalist/archive/2006-01/msg00502.html
> http://www.stata.com/statalist/archive/2003-09/msg00507.html
> http://www.stata.com/statalist/archive/2004-03/msg00846.html
> http://www.stata.com/statalist/archive/2004-05/msg00666.html
>
>
> My code for one of the individual graphs and for the combined graph follows:
> *INDIVIDUAL GRAPH (line returns added to improve readability)
> twoway (hist rearnings2 if lyear==1979 & worker & `gend' [fw=fwgt], percent lwidth(medthick) width(5000) start(0) fcolor(none) lcolor(black)) ///
> (hist rearnings2 if lyear==2007 & worker & `gend' [fw=fwgt], percent lwidth(vvthin) width(5000) start(0) fcolor(gs9) lcolor(gs7) barwidth(2000)) ///
>
> ,legend(label(1 "1979") label(2 "2007") symysize(*.25) symxsize(*.25) size(tiny) width(22) forcesize) xlabel(0(25000)125000) xlabel(157500 ">150,000", add custom tp(c) tl(3)) ///
>
> xtitle("Annual earnings ($2007)") graphregion(lcolor(none) ilcolor(none) fcolor(white) ifcolor(white) lwidth(thick)) plotregion(lcolor(none) ilcolor(none) style(none)) bgcolor(white) ///
>
> title("Distribution of earnings in 1979, 2007") name(Fig`i'Ahist, replace)  xline(152500, lcolor(black) lpattern(shortdash)) ylabel(, angle(horizontal) nogrid) ///
>
> note("Each bin is a $5,000 interval except the last, which includes all workers making more than $150,000", size(small))
>
> *COMBINED GRAPH
> grc1leg Fig1Ahist Fig1Bhist2_5 Fig1Chist Fig1Dhist5, name(combo1) xsize(8.4) ysize(6) title("Figure 1. All workers", size(small)) altshrink note("includes all male and female workers, age 18-64", size(tiny)) ///
>        graphregion(lcolor(none) ilcolor(none) fcolor(white) ifcolor(white)) ///
>        plotregion(lcolor(none) ilcolor(none) style(none)) bgcolor(white)
>
> Thanks for your consideration.
> Howie
>
> Howie Lempel
> Research Assistant
> The Brookings Institution | Economic Studies
>
> 1775 Massachusetts Ave NW | Washington DC 20036
> hlempel@brookings.edu | p: (202) 238-3576

*
*   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/

*
*   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   |   What's new   |   Site index