Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Changing title with by option ?


From   Eric Booth <[email protected]>
To   "<[email protected]>" <[email protected]>
Subject   Re: st: Changing title with by option ?
Date   Thu, 15 Jul 2010 14:43:38 +0000

<>

Hi  

You can avoid using the graph editor by treating each "by" category as an "if" condition for a separate graph and then using -graph combine- to put them together:

******************!
clear
**SETUP:     create vars  and label vars**
set obs 100
g x = abs(runiform()*100)
g y = abs(runiform()*10)
g category = 1+int((3-1+1)*runiform())
	lab var x "Quantity of X"
	lab var y "Quantity of Y"


**label values**
lab def ll 1 "Mining/Quarrying/Oil&Gas/Extraction/Utilities/Construction/Manufacturing" , modify
lab def ll 2 "Extraction/Mining/Construction/Manufacturing/Quarrying/Oil&Gas/Utilities" , modify
lab def ll 3 "Oil&Gas/Utilities/Extraction/Mining/Construction/Manufacturing/OTHER", modify
lab val category ll
la li

**graph titles**
local title1 ""{bf:Mining/Quarrying/Oil&Gas}" "Extraction/Utilities" "{it:Construction/Manufacturing}"" 
local title2 ""{bf:Extraction/Mining/Construction}" "Manufacturing/Quarrying" "{it:Oil&Gas/Utilities}"" 
local title3 ""{bf:Oil&Gas/Utilities/Extraction}" "Mining/Construction" "{it:Manufacturing/OTHER}""

*************
*************


//EXAMPLE 1//
****create graphs & combine****
qui su categ
forval n = `r(min)'/`r(max)' {
	scatter y x if category==`n',    ///
    title(`title`n'', size(medsmall)) name(graph`n', replace) 
    graph save graph`n' "graph`n'.gph", replace
      }
    graph combine graph1 graph2 graph3, ///
    rows(1) title("{stSerif:OVERALL TITLE GOES HERE}")  note("{bf:Source:}  Data source is X") 



//EXAMPLE 2//
**Put this info in a text box or note and use shorter titles:

qui su categ
forval n = `r(min)'/`r(max)' {
	scatter y x if category==`n',    ///
title({stSerif:Industrial Activities for {bf:Nation `n'}}, size(medsmall)) name(graph`n', replace)  ///
text(1 85 `title`n'', orient(horizontal) si(vsmall) justification(center) box ) 
    graph save graph`n' "graph`n'.gph", replace
      }
    graph combine graph1 graph2 graph3, ///
    rows(1) title("{bf:{stSerif:OVERALL TITLE GOES HERE}}")  note("{bf:Source:}  Data source is X") 
******************!

I prefer to have less information than is in your value labels as the title of a graph.  I think the information in your value labels is better used in a note, text box, etc; so,  I would probably go with something closer to EXAMPLE 2 above.

~ Eric

__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
[email protected]
Office: +979.845.6754



On Jul 15, 2010, at 5:35 AM, Maarten buis wrote:

> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
> 
> http://www.maartenbuis.nl
> --------------------------
> 
> 
> --- On Thu, 15/7/10, Heekyung Hellen Kim wrote:
>>> My label for category is too long to put in one
>>> line over each graph.  Is there any way to appear
>>> in two lines?
>>> 
>>> For example, 
>>> 
>>> Category 1 = Mining/Quarrying/Oil&Gas
>>> Extraction/Utilities/Construction/Manufacturing
> 
> --- On Thu, 15/7/10, Maarten buis wrote:
>> Yes, but for titles above each by-graph you will 
>> need to use the graph editor:
>> 
>> 1. Create your graph with the long titles
>> 2. Open the graph editor, within the graph window
>>    go to File, and than to Start Graph Editor.
>> 3. click on the title you want to change
>> 4. enclose each part that you want to appear on a
>>    single line in double quotes. So in your case:
>> "Mining/Quarrying/Oil&Gas" "Extraction/Utilities/
>> Construction/Manufacturing"
> 
> I've shown this recommendation in the movie below:
> <http://www.screencast.com/users/maartenbuis/folders/Jing/media/3b2dfbc4-25c8-49e8-b19e-8f9d8120a738>
> 
> Hope this helps,
> Maarten
> 
> 
> 
> 
> *
> *   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index