[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Post-editing of graphs by code?

From   "Scott Merryman" <>
Subject   Re: st: Post-editing of graphs by code?
Date   Fri, 25 Jul 2008 10:11:29 -0500


A couple comments.

1.  To understand the context better, it would be nice to know what
type of graphs you are creating that need to be edited
post-production.  I assume, by the example you referenced, it is
editing -twoway, by()- graphs.  In your context, could you have used
-graph combine- ?

2.  The Recording (*.grec) files are simply text files.  They can be
opened up, examined and edited.  For example, wrapping the individual
graph titles produced with -by()- can be recorded and then the edits
can be incorporated into a do-file

sysuse auto, clear

label defin foreign 0 `"realy long" "title"' /*
               */  1 `""another" "long title""'
label value foreign foreign
twoway scatter pri mpg, by(foreign)

gr_edit .plotregion1.subtitle[1].text = {}
gr_edit .plotregion1.subtitle[1].text.Arrpush `"realy long"'
gr_edit .plotregion1.subtitle[1].text.Arrpush `"title"'

gr_edit .plotregion1.subtitle[2].text = {}
gr_edit .plotregion1.subtitle[2].text.Arrpush `"another"'
gr_edit .plotregion1.subtitle[2].text.Arrpush `"long title"'

3.  As to why -gr_edit- is not documented (or even undocumented) Stata
would have to reply.  Though the syntax seems a little unintuitive
(Arrpush??).  Perhaps Stata could develop some post-production
command-line editing tools or even better, would be to have more
control over the individual graph elements that are produced by
-twoway, by()-


On Thu, Jul 24, 2008 at 7:45 AM, Tobias Pfaff
<> wrote:
> Thanks Scott! I hadn't downloaded all the Stata 10 updates and was thus not
> aware of the Graph Recorder.
> The code I was looking for is hidden in the .grec files. In my do-file, I
> can now remove the unwanted notes from the combined graph using code. This
> avoids opening the graph editor and using the cumbersome point-and-click
> method:
> gr_edit .plotregion1.graph1.note.draw_view.setstyle, style(no)
> gr_edit .plotregion1.graph2.note.draw_view.setstyle, style(no)
> gr_edit .plotregion1.graph3.note.draw_view.setstyle, style(no)
> I don't really get why Stata doesn't provide documentation for this
> graph-editing code. In my opinion, this gives Stata the ultimate flexibility
> for creating and editing graphs. The -graph addplot- was unfortunately too
> restricted for my needs. And the graph recorder is also not as flexible as
> coding can be.
> Cheers,
> Tobias
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index