Bookmark and Share

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

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

RE: st: Access to commands for alterations made using Graphics Gditor

From   Nick Cox <>
To   "''" <>
Subject   RE: st: Access to commands for alterations made using Graphics Gditor
Date   Tue, 21 Sep 2010 12:23:11 +0100

I think the short answer to Paul is that there is no easy way that he can use to translate automatically to the -graph- syntax he knows. 

Developing this a bit and interpolating between various Stata developer comments: 

Paul is seeing low-level language that is intended primarily for Stata's internal consumption. 

Since Stata 8 came out I know of precisely one person outside StataCorp who has had the perseverance and ingenuity to work up a good understanding of this low-level language, Sergiy Radyakin. 

I am a fairly dedicated user of Stata's graphics and have written several programs on top of it, but whenever I've felt I needed to know some of this low-level language perseverance of a different kind has typically shown a way round. 

There was for a while an intention that StataCorp would document this language, but it was quickly realised that that would mean writing, in effect, an extra volume of the manual for about three people. Those three people (plus or minus a few, perhaps) may feel cheated, but the rest of the user community benefits from whatever the developers did with the time freed. 

So, Paul, you would need a manual volume to help you do this, but it does not exist. If it did exist, you would still need to exert considerable programming skills. 


Paul O'Brien

the best description of this was sent to me by Luis Armando Galvis off list (thanks). he pointed me to this page:

as it is buried in the page i have copied it here:
> Getting Stata's Graph editor commands into Stata graphs
> Stata has a great graph editor. However, after you have modified your graph the editor will not produce the normal Stata code for this graph. However, it is possible to retrieve the editing commands if they have been recorded using the Stata graph editor recorder, adding gr_edit at the start of each editor line and then adding this to the initial graph code. Now you have the code to reproduce the graph.
> Example:
> Assume that you have run the following
> sysuse auto, clear
> histogram mpg
> Then click on the Start Graph Editor icon and pressed the Start recording icon. Then altered the color of the histogram bins. Then stop the recorder and saved the record on the hard disk with a suitable name and path. Then opened the record (just saved) in Stata's do editor.
> the line:
> area(shadestyle(color(gs7))) editcopy
> was retreived and gr_edit added to the from of this.
> the complete file would look like:
> sysuse auto, clear
> histogram mpg
> gr_edit area(shadestyle(color(gs7))) editcopy
> this is run and will produce the original graph complete with the edit.
> Alternatively you could save the recording and include it as follows:
> sysuse auto, clear
> histogram mpg, play(hist1) //hist1 is the name of the recording
> Also see:
> help graph play 

now, the question is how to translate this line:

gr_edit area(shadestyle(color(gs7))) editcopy

into a command. 

this is a very simple one, changing colour. are there general rules?

On 20 Sep 2010, at 16:37, Paul O'Brien wrote:

> i would love to be able to inspect, and later use, the commands issued in the Graphics Editor.
> i know i can record the changes, but i want to see the commands.
> is this possible?

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index