Reputation: 33
I'm working in Stata 13.1. Is there any way to plot 3 different predicted_responses (with different colour) for every hour (24,48,72), in the same plot? With my code I receive 3 graphs but I want only one.
My code:
gr7 predicted_response Response Concentration if Hours==24, xlab ylab c(l.) s(iO)
gr7 predicted_response Response Concentration if Hours==48, xlab ylab c(l.) s(iO)
gr7 predicted_response Response Concentration if Hours==72, xlab ylab c(l.) s(iO)
Upvotes: 0
Views: 573
Reputation: 37208
This is a fairly literal translation, with some extra bells and whistles.
line predicted_response Concentration if Hours==24, lc(red) sort
|| line predicted_response Concentration if Hours==48, lc(blue) sort
|| line predicted_response Concentration if Hours==72, lc(black) sort
|| scatter Response Concentration if Hours==24, mc(red)
|| scatter Response Concentration if Hours==48, mc(blue)
|| scatter Response Concentration if Hours==72, mc(black)
legend(order(4 "24 hours" 5 "48 hours" 6 "72 hours"))
ytitle(Observed and predicted response)
Note also the separate
command and what it allows.
Upvotes: 2
Reputation: 1103
twoway scatter x y if z == 1, c(L) || ///
scatter x y if z == 2, c(L) || ///
scatter x y if z == 3, c(L) || ///
gr7
is not compatible with twoway
but you should be able to use scatter
or line
instead.
Note: gr7
is an outdated Stata command that you shouldn't rely on; learn to use the standard graphing commands; see help graph
.
Upvotes: 0