[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Parse graphsize from schemes into program
Uli Kohler <firstname.lastname@example.org> asks about reading the default graph size
from the current graphics scheme,
> in a program I want to set the default xsize() of a graph equal to
> the -graphsize y- of the scheme.
> Is there a way to read the default graph size from the scheme which
> is actually loaded?
The concept of a current scheme is rather plastic in the graphics environment.
For example, it is possible to -graph combine- two graphs drawn with different
schemes and for those graphs to maintain their original schemes.
It is safest for Uli to first draw a graph using the desired scheme, then pull
the size from the graph's own scheme object. For example, after
. scatter mpg weight , nodraw
Uli, could type
. di `.Graph._scheme.graphsize.y'
to see the default graph y size for the scheme, or
. local ysize `.Graph._scheme.graphsize.y'
to put that size in a local macro.
We are doing nothing more more than pulling the value of an sub-object from
within the object that holds our graph. Because we did not name our graph, it
is named "Graph" and that is where we got the first part of the name
All graph hold a reference to the scheme they were drawn with in the
Schemes all define a graphsize sub-object
And it contains the x and y size of the graph
In Stata, this nested name can be treated just like a local macro name and
dereferenced using macro quotes, and that is how we fetched the value
* For searches and help try: