Closed Yuji-Shimohira-Calvo closed 7 years ago
Hi there, sorry for not replying earlier, I was traveling.
Your guess is close to being correct, line 197 of ipystata_magic_batch.py does the export:
myfile.write('graph export "%s", replace' % graph_out + "\n")
Where graph_out
is just the path to temp_graph.pdf
.
I have never used graphexportpdf but it should be easy to replace line 197 with something like:
myfile.write('graphexportpdf "%s", dropeps' % os.path.join(iPyStata.tornado_dir, 'temp_graph') + "\n")
That way it will export it through graphexportpdf instead of the usual export function.
I don't know if you are familiar with slightly modifying a package from GitHub and installing it but these are the steps in case they are helpful:
cd
to the folder where you cloned it to.python setup.py install
Hope it works!
Thanks for your help, Ties.
Your suggestion did not work at first, but after a good hour of wracking my head I realised the problem was much easier than what I thought.
The problem was in the string "%s" that calls the working directory. It seems that the Stata command graphexportpdf does not accept quotation marks, so substituting %s for "%s" did the job.
Thanks for your help again!! (Feel free to close this thread :)
My bad, good to hear it works!
Hi Ties,
Hope this finds you well. I am trying to use the --graph option in Linux but I keep getting a 404 error (more specifically "No such file or directory: temp_graph.pdf"). I assume this is Stata's problem when exporting a graph to PDF---although I might be totally wrong. If I try to do the same from within Stata's GUI I get an error which is quite well-documented online. The "problem" was solved in Stata14, but unfortunately I am using Stata13.
There is an user-written package called "graphexportpdf"; it is quite old but still works in Linux. If I am correct in thinking that "%%stata -gr" uses "graph export name, as(pdf) replace" in Stata... will it be very difficult to accommodate "graphexportpdf" (the user-written package) at least in my installation? Any help/suggestions would be greatly appreciated.
Thanks!