Announcement

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

  • No Graph window open wrror

    I made a scatterplot and saved it as "Reading graph". After this I exported the file as a PDF. Then I used the command: graph export "Reading Graph.pdf", as (pdf) replace.

    How can I fix this error?

  • #2
    What error?

    Please show the actual commands you gave and exactly what Stata responded by copy/pasting from your log file or Results window into a code block here. (See FAQ #12 for information about code blocks.)

    Comment


    • #3
      graph export "C:\Users\sean.fortney\Reading Graph.pdf", as(pdf) replace
      no Graph window open
      r(601);

      end of do-file


      ^ I copied and pasted that, the "no Graph window open" was in red

      Comment


      • #4
        Well, it means just what it says. You have to have an open graph at the time you export it. So just bring the graph back in:

        Code:
        graph use "Reading Graph"
        graph export "Reading Graph.pdf", as(pdf) replace

        Comment


        • #5
          I am having a similar problem, and it's driving me mad. -graph use- only seems to confound the problem.

          This is the code I'm using:

          Code:
          scatter y1 y2 y3 y4 y5 y6 x, ///
          ytitle("Proportion" " ", color(black)) ///
          ylabel(#7, labcolor(black)) scheme(s2mono) ///
          xtitle(" " "Proportion") ///
          sort(collprop) ylabel(0(.05).3) ///
          msymbol(o o o o o o) msize(large large large large large large) ///
          mcolor(538b 538r 538g 538y 538m 538o) ///
          lcolor(538b 538r 538g 538y 538m 538o) ///
          xlabel(0.08(.04).4, labcolor(black)) connect(l l l l l l l l l l l) ///
          lwidth(thick thick thick thick thick thick)  ///
          legend(order(1 "y1" 2 "y2" 3 "y3" 4 "y4" 5 "y5" 6 "y6"))
          graph save "Q:\postdoc\horowit1\Academic Files Spring 2012\APC Jobs\Graphing Results\core.gph", replace
          Without -graph use- I get a "no current graph" error message.

          I used -graph use- and then the strangest thing happened...it worked for that graph, but then every graph I ran after that and tried to save decided to save this graph. So for example, if I ran a graph that plotted y7-y11 but otherwise used the same code, and then I tried to open it using -graph use- and save it, it would save my "core" graph as that filename instead of the one I was trying to save.

          So then I used -graph drop _all- before -graph use- to clear everything out of memory, and it reverted back toward the original problem: "no current graph" error message.

          Does anyone have any idea what's happening here?
          Last edited by Jonathan Horowitz; 20 May 2019, 11:15.

          Comment


          • #6
            Originally posted by Sean Fortney View Post
            I made a scatterplot and saved it as "Reading graph". After this I exported the file as a PDF. Then I used the command: graph export "Reading Graph.pdf", as (pdf) replace.

            How can I fix this error?
            I have a similar situation. By trying to save a graph through a command line:
            Code:
            graph export "C:\OneDrive\Z\mild_T1.png", as(png) name("mild_T1") replace
            I get the error message
            Code:
            could not find Graph window
            r(693)
            despite the graph window being actually open. If I, however, save the graph manually, then the command generated by Stata is the same as the one I wrote, apart from calling any graph “Graph” (only in the command line, however: the graph name is the one I chose):
            Code:
            graph export "C:\ OneDrive\Z\mild_T1.png", as(png) name("Graph") replace
            The practical implication of that is that I have to save graphs manually one by one, instead of using a single “.do” file to save them all in one run.


            Comment


            • #7
              Originally posted by Federico Tedeschi View Post
              Code:
              graph export "C:\OneDrive\Z\mild_T1.png", as(png) name("mild_T1") replace
              I found out what my mistake was: apparently, when graphs are generated, they are named "Graph", so I should keep such name in "name("")", while the actual name of the file that is saved is another issue.

              Comment

              Working...
              X