Statalist


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

Re: AW: st: graph -by- option


From   Sergiy Radyakin <serjradyakin@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: AW: st: graph -by- option
Date   Tue, 11 Aug 2009 15:41:20 -0400

Adding to Martin's solution:
and we don't have to carry another file. Rather we can customize the
graph after it is built already.
(warning: you can not save the graph with such modifications as below
- they are not included into
the internal graphing program and will be lost if you save to *.gph
and reopen that file, you probably
remember it from my presentation at the Stata User Group Meeting in DC).

version 9.2
sysuse auto, clear
set obs `=_N+1'
replace foreign = 0.5 in l
twoway scatter rep78 mpg, by(foreign, cols(3))
.Graph.plotregion1.subtitle[2].text = {}
.Graph.plotregion1.xaxis1[2].draw_view.setstyle, style(no)
.Graph.plotregion1.plotregion1[2].EditCustomStyle , j(-1)
style(boxstyle(shadestyle(color(none))))
.Graph.plotregion1.plotregion1[2].EditCustomStyle , j(-1)
style(boxstyle(linestyle(color(none))))
graph display
/* end of file */

Best regards,
   Sergiy Radyakin





On Tue, Aug 11, 2009 at 8:51 AM, Jeph Herrin<junk@spandrel.net> wrote:
>
> My first attempt was using missing data for the middle
> graph, but I didn't want to manually edit each time. Using
> the recorder is a good tip - I'll -play- around with it a
> bit.
>
> thanks,
> Jeph
>
>
> Martin Weiss wrote:
>>
>> <>
>> True! And to make this worthwhile, let the graph editor do its magic...
>>
>>
>> *************
>> sysuse auto, clear
>>
>> set obs `=_N+1'
>> replace foreign = 0.5 in l
>>
>> twoway scatter rep78 mpg,/*  */  by(foreign, cols(3))
>>
>> gr play edit
>> *************
>>
>> with file edit.grec defined as follows, to be saved to the PERSONAL/grec
>> directory:
>>
>>
>> *************
>> StataFileTM:00001:01100:GREC:                          :
>> 00003:00003:00001:
>> *! classname: bygraph_g
>> *! family: by
>> *! date: 11 Aug 2009
>> *! time: 10:09:57
>> *! graph_scheme: s2color
>> *! naturallywhite: 1
>> *! end
>>
>> // File created by Graph Editor Recorder.
>> // Edit only if you know what you are doing.
>>
>> .plotregion1.subtitle[2].text = {}
>> // subtitle[2] edits
>>
>> .plotregion1.xaxis1[2].draw_view.setstyle, style(no)
>> // xaxis1[2] edits
>>
>> .plotregion1.plotregion1[2].EditCustomStyle , j(-1)
>> style(boxstyle(shadestyle(color(none))))
>> .plotregion1.plotregion1[2].EditCustomStyle , j(-1)
>> style(boxstyle(linestyle(color(none))))
>> // plotregion1[2] color
>>
>>
>> // <end>
>>
>> *************
>>
>>
>>
>> HTH
>> Martin
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: owner-statalist@hsphsun2.harvard.edu
>> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Philipp Rehm
>> Gesendet: Dienstag, 11. August 2009 10:07
>> An: statalist@hsphsun2.harvard.edu
>> Betreff: Re: st: graph -by- option
>>
>> .
>> One possible workaround may be to add fake-observations to your dataset.
>>
>> Here is an example:
>>
>> sysuse auto, clear
>> set obs `=_N+1'
>> replace foreign = 0.5 in `=_N'
>> twoway scatter rep78 mpg, by(foreign, cols(3))
>>
>> HTH,
>> Philipp
>>
>> Maarten buis wrote:
>>>
>>> --- On Mon, 10/8/09, Jeph Herrin wrote:
>>>>
>>>> I am making a series of graphs, each of which
>>>> includes of a -by- over a 3 valued variable Z.
>>>> Three plots are produced in a single row.
>>>>
>>>> For some graphs, the second value of Z (Z=2) has
>>>> no data, so there are only 2 plots. I would like
>>>> -by- to produce a 1x3 layout, with -hole(2)-, but
>>>> this doesn't seem to be doable. I have only been
>>>> able to produce either 1) 2 plots, with no hole
>>>> in the middle or 2) 3 plots, the center one with no
>>>> data. Is there a way to trick -by- into leaving a
>>>> hole in the middle position?
>>>>
>>>> I realize that -graph combine- might solve this
>>>> problem, but it has a separate problem in that
>>>> I cannot omit the axes between plots.
>>>
>>> I have no solution, just an example of what I expected to produce the
>>> graphs you want (two graphs in a row with a blank spot in the middle), but
>>> didn't. Maybe this example code inspires someone.
>>>
>>> *------- begin example -----------
>>> sysuse auto, clear
>>> twoway scatter rep78 mpg, ///
>>>   by(foreign, cols(3) holes(2))
>>> *--------- end example -----------
>>>
>>> Hope this helps,
>>> Maarten
>>>
>>> -----------------------------------------
>>> Maarten L. Buis
>>> Institut fuer Soziologie
>>> Universitaet Tuebingen
>>> Wilhelmstrasse 36
>>> 72074 Tuebingen
>>> Germany
>>>
>>> http://home.fsw.vu.nl/m.buis/
>>> -----------------------------------------
>>>
>>>
>>>
>>>
>>> *
>>> *   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/
>>
>>
>> *
>> *   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/
>

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