Announcement

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

  • Error: Graph_x is not a memory graph

    Hi everyone,

    I have a question about combine graphs in stata.

    I have two figures, say Figure1 and Figure2. And when I was trying to combine them together in stata, I used command graph combine Figure1 Figure2, r(2).

    However, stata popped up an error saying that Figure2 is not a memory graph. I checked the directory and I've saved them there. I can also open the gph files one by one in stata but just can't use the command. Sometimes the warning would be Figure1 is not a memory graph.

    I wonder if anyone of you has encountered anything like this before. It would be great if you can give me some suggestions for the possible reasons.

    Thank you very much!

  • #2
    You should use
    Code:
    graph combine "figure1" "figure2"
    or

    Code:
    graph combine figure1.gph figure2.gph
    Best regards.

    Raymond Zhang
    Stata 17.0,MP

    Comment


    • #3
      Also you can use the option "name()" when you plot the graph.for example
      Code:
      sysuse auto,clear
      scatter price mpg,name(figure1)
      scatter price weight,name(figure2)
      graph combine figure1 figure2
      Best regards.

      Raymond Zhang
      Stata 17.0,MP

      Comment


      • #4
        Originally posted by Raymond Zhang View Post
        You should use
        Code:
        graph combine "figure1" "figure2"
        or

        Code:
        graph combine figure1.gph figure2.gph
        Hi Raymond,

        Thank you so much for your reply. I tried the code with .gph and it works now. However, I'm still very confused because I've combined other figures without .gph and they work very well. Do you have any idea about the possible reasons why I can't use the same code for these two figures.

        Thanks a lot!

        Comment


        • #5
          If you use graph save,and then use graph combine,the you should use .gph or "figure".If you use name() option,then you need not code with .gph.
          You can give an example to show the question.
          Best regards.

          Raymond Zhang
          Stata 17.0,MP

          Comment


          • #6
            Originally posted by Raymond Zhang View Post
            If you use graph save,and then use graph combine,the you should use .gph or "figure".If you use name() option,then you need not code with .gph.
            You can give an example to show the question.
            Hi Raymond,

            I see. It may have something to do with the way I save the graphs in the first place. Both of the methods you mentioned solved my problem.

            Thanks a lot!

            Comment

            Working...
            X