Closed ideabucket closed 2 years ago
I realised that this is the result of not naming the graphs. This:
sysuse auto
scatter weight mpg, name(weight_mpg)
scatter length mpg, name(length_mpg)
…outputs both graphs. The only caveat is that the graphs are appended to the end of the stata output rather than being inserted after the command that generated them. So if you do something that returns textual output after the graphs, the graphs will follow the output of the command that was run later, e.g.:
sysuse auto
scatter weight mpg, name(weight_mpg)
scatter length mpg, name(length_mpg)
tab foreign rep78
…will return the following sequence of output:
. sysuse auto (1978 automobile data) . scatter weight mpg, name(weight_mpg) . scatter length mpg, name(length_mpg) . tab foreign rep78 [output of 'tab foreign rep78'] [graph 'weight_mpg'] [graph 'length_mpg']
I just checked and the issue lies with pystata itself:
If you do this in one cell:
You will only get one graph back---the one for
scatter length mpg
. The echo back from the kernel shows both graph commands run, but it looks like the graphs clobber each other.Fairly straightforward to work around using
graph combine
or just putting the commands in separate cells, though.