Announcement

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

  • Position of legend in a combined graph

    Dear All,

    I generate sever graphs, which I like to combine in one. Each graph displays its legend (which is actually common to all of them). When I combine graphs, the legend is moved upon the figure. I am just wondering if there is any chance to use only one legend, which I put at the end of the combined graph.

    Code:
    foreach v of local regressors{
    grmap msp_resi1_`v' if NUTS_ID!="ES70" & NUTS_ID!="PT30" & NUTS_ID!="PT20", fcolor(blue blue*0.2 red*0.2 red) clmethod(custom) clb(0 1 2 3 4) legend(order( 5 "High-High" 4 "High-low" 3 "Low-High" 2 "Low-Low") position(3)) title(`v') name(LISA`v')
    }
    
    graph combine LISA1 LISA2 LISA3 LISA4 LISA5 LISA6 LISA7
    I tried to remove the legend from the loop and put it in the graph combine, but it does not work.I tried to change the position of lagend, but whichever position I choose, the result is not different.

    Any idea?

    Thanks in advance,

    Dario
    Click image for larger version

Name:	LISAall.png
Views:	1
Size:	295.8 KB
ID:	1754970

    Last edited by Dario Maimone Ansaldo Patti; 30 May 2024, 09:48.

  • #2
    Yes, you can recast your problem so that the graph comes out of a by() option rather than graph combine.

    Code:
    SJ-20-4 gr0085  .  The by() option of graph can work better than graph combine
            . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
            4/20    SJ 20(4):1016--1027                              (no commands)
            describes whether to use the by() option of graph or
            graph combine for paneled figures

    Comment


    • #3
      You might want to try the community-contributed command grc1leg2, available from
      Code:
      net install grc1leg2.pkg

      Comment


      • #4
        Nick Cox and Hemanshu Kumar Thank you. I noted that the command grc1leg2 also offers example using the by option. It also has a very detailed and useful help file.

        Comment


        • #5
          My ado command -grc1leg2- is easier to describe or install with the command:
          Code:
          view net describe grc1leg2, from("http://digital.cgdev.org/doc/stata/MO/Misc")

          Comment

          Working...
          X