如何覆盖在塔塔在同一图形多条曲线?(How to overlay multiple plots on

2019-09-23 00:45发布

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.

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

Answer 1:

作为@whuber亲切提到的,我们需要使用|| 吸引更多的东西。 我用下面的代码来绘制,我需要在同一个图形类型的不止一个情节。 谢谢。

    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


文章来源: How to overlay multiple plots on the same graph in Stata?