如何在Stata中的同一张图上覆盖多个图? [英] How to overlay multiple plots on the same graph in Stata?
问题描述
我正在使用以下代码在Stata中的图形上绘制图。我想在同一张图上绘制多个图。那可能吗?谁能告诉我该怎么做?
I am using the following code for drawing a plot on a graph in Stata. I want to draw multiple plots on the same graph. Is that possible? Can anyone kindly tell me what to do?
我想做的是在同一张图中包含以下类型的多个图。
What I want to do is to have multiple plots of the following types in the same graph.
进一步的澄清:每个X值都有多个均值和CI,即每个模拟模型都有一个均值和CI。
Further clarification: There will be multiple means and CIs for each value of X, i.e. one mean and CI for each simulation model. All the means and CIs for one simulation model will be connected together.
clear
input str2 varname mean upper lower
x1 30 25 35
x2 50 20 80
x3 60 50 70
x4 60 55 65
x5 65 55 75
end
encode varname, gen(varname1)
scatter mean varname1, xlabel(, valuelabel) || rcap upper lower varname1 || line upper mean lower varname1
推荐答案
如@whuber所言,我们需要使用 |||
画更多的东西。我使用以下代码在同一张图上绘制了多个所需类型的绘图。
As @whuber kindly mentioned, we need to use ||
to draw more things. I used the following code to draw more than one plot of the type I need on the same graph. Thanks.
clear
input str2 varname mean upper lower
x1 30 25 35
x2 50 20 80
x3 60 50 70
x4 60 55 65
x5 65 55 75
end
encode varname, gen(varname1)
input str4 varname4 mean4 upper4 lower4
x1 40 35 45
x2 60 30 90
x3 70 60 80
x4 70 65 75
x5 75 65 85
scatter mean varname1, xlabel(, valuelabel) || rcap upper lower varname1 || line upper mean lower varname1 ||scatter mean4 varname1, xlabel(, valuelabel) || rcap upper4 lower4 varname1 || line upper4 mean4 lower4 varname1
这篇关于如何在Stata中的同一张图上覆盖多个图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!