Statalist The Stata Listserver

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

st: RE: Combined graphs that overlay

From   "David Harrison" <>
To   <>
Subject   st: RE: Combined graphs that overlay
Date   Mon, 8 May 2006 09:42:54 +0100

Although it is not documented (to my knowledge), you can add additional
twoway plots to an existing twoway plot (or something that has been
built with a twoway plot, even if you did not know it at the time, such
as -histogram-) using -graph addplot-. This does not really give you any
more functionality than the -addplot()- option, but you can add the
extra plot(s) later (even adding them to a saved graph) without needing
to start again from scratch, e.g.

sysuse auto
hist price, percent
graph addplot scatter mpg price
graph addplot scatter turn price, legend(on row(1)) ytitle("")

You can also use -graph describe- to obtain the details of named/saved
graphs which can then be recreated in an overlaid  plot (although this
would probably require some care with options in particular).

I can't see any reason why some kind of -graph overlay- subcommand could
not be created for overlaying named/saved twoway plots.


-----Original Message-----
[] On Behalf Of Allan Reese
Sent: 05 May 2006 12:35
Subject: st: Combined graphs that overlay

I've tried a couple of times to overlay different types of graph, and
not come up with a satisfactory solution.  The low level commands of
Stata 7 could be programmed to do this, but "graph combine" allows only
for graphs to butt against each other.  One example would be to place
pies or barcharts at X-Y positions to make a simple map.

a) Is there an obvious solution I've overlooked?

b) Do other users see a general need?

c) Could it be implemented as an option to combine? Maybe: at(graphno r
c xscale yscale) where r and c refer to absolute position in the
plotting area (see help gph).  Eg

graph combine gr1 gr2 gr3, at(1 23063 0 .5 1) at(2 23063 16001 .5 1)
at(3 11531 20001 .1 .1)


This email has been scanned by the MessageLabs Email Security System.
For more information please visit 

*   For searches and help try:

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