Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • combining dotplot graphs

    I can't succed in combining dotplot graphs: I have there distinct groups of observations, marked with different colours.

    dotplot ln_IGG if IGG!=. & dose==2 & gruppo=="ospite", over(DOTPLOT) yline(3.912023) yline(6.9077553) color(black) /// name(graph1, replace)
    dotplot ln_IGG if IGG!=. & dose==1 & gruppo=="ospite", over(DOTPLOT) yline(3.912023) yline(6.9077553) mfcolor(white) mlcolor(black) /// name(graph2, replace)
    dotplot ln_IGG if IGG!=. & (dose==0 & pregresso==1) & gruppo=="ospite", over(DOTPLOT) yline(3.912023) yline(6.9077553) mfcolor(gray) mlcolor(black) /// name (graph3, replace)

    I tried with the following ...
    graph combine graph1 graph2 graph3, common
    ... but it doesn't work!


    Thanks for any kind help.

    Mario Saugo
    UOSD Epidemiologia
    ULSS 7 Veneto
    Italy

  • #2
    Never say just that something "doesn't work" or "didn't work", but explain precisely in what sense you didn't get what you wanted.
    There is nothing here to get hold of except some code that is quite difficult to follow. No data example, no graph. Please do read

    https://www.statalist.org/forums/help (the quotation above is from that page).


    When the + New Topic prompt says

    First read Advice on Posting.
    it really does mean what it says.


    Looking at your code, you have simple ways of making your question more clear.

    Code:
    dotplot ln_IGG if IGG!=. & dose==2 & gruppo=="ospite", over(DOTPLOT) yline(3.912023) yline(6.9077553) color(black) /// name(graph1, replace)
    dotplot ln_IGG if IGG!=. & dose==1 & gruppo=="ospite", over(DOTPLOT) yline(3.912023) yline(6.9077553) mfcolor(white) mlcolor(black) /// name(graph2, replace)
    dotplot ln_IGG if IGG!=. & (dose==0 & pregresso==1) & gruppo=="ospite", over(DOTPLOT) yline(3.912023) yline(6.9077553) mfcolor(gray) mlcolor(black) /// name (graph3, replace)
    It seems that you are not asking about added lines or colours, so clear that stuff out of the way.


    Code:
    dotplot ln_IGG if IGG!=. & dose==2 & gruppo=="ospite", over(DOTPLOT) name(graph1, replace)
    dotplot ln_IGG if IGG!=. & dose==1 & gruppo=="ospite", over(DOTPLOT) name(graph2, replace)
    dotplot ln_IGG if IGG!=. & (dose==0 & pregresso==1) & gruppo=="ospite", over(DOTPLOT) name(graph3, replace)
    If IGG is missing, its logarithm is too, and Stata just ignores that, so that can be cut too;

    Code:
    dotplot ln_IGG if dose==2 & gruppo=="ospite", over(DOTPLOT) name(graph1, replace)
    dotplot ln_IGG if dose==1 & gruppo=="ospite", over(DOTPLOT) name(graph2, replace)
    dotplot ln_IGG if (dose==0 & pregresso==1) & gruppo=="ospite", over(DOTPLOT) nam(graph3, replace)
    Now it seems that you have three groups you care about, which perhaps should be defined directly, although defining some value labels is important.

    Code:
    gen group = 1 if dose==0 & pregresso==1 & gruppo=="ospite"
    replace group = 2 if dose==1 & gruppo == "ospite"
    replace group = 3 if dose==2 & gruppp == "ospite"

    Now my guess is the real problem is that you want something like


    Code:
    dotplot ln_IGG , by(group) over(DOTPLOT)
    except that isn't supported, to which one answer is now

    Code:
    ssc desc stripplot


    to find a command on SSC,

    Comment

    Working...
    X