0
$\begingroup$

I have defined two plots and then want to merge them into one so that I can save the figure as a pdf file into my computer. Here is MWE where I would like to merge two plots into one:

plot1 = LogPlot[...];
plot2 = LogPlot[...];
GraphicsColumn[{plot1, plot2}, AspectRatio -> 1]

I can successfully plot 1 and 2 independently and save them as two separate pdf files. Both plots have accompanying legends. However, after merging them into one figure, I do not know how to save it as a pdf file as I am not given any such option by right-clicking on the figure. Your help is greatly appreciated.

Thanks,


Here is the plot I am getting from Grid command:enter image description here

$\endgroup$
  • $\begingroup$ Export["plot.pdf",Grid[{{plot1},{plot2}}]]. If you want to use click, then select the full figure and go to File>Save Selection As and then save it as a pdf. $\endgroup$ – Sumit May 29 '16 at 6:48
  • $\begingroup$ Hi Sumit, thanks. The first code produces some file that is very very messed up that you cannot even realize anything from it. And the second one just takes forever to be saved. I think I need to write my plots completely so that help may be faster. $\endgroup$ – Benjamin May 29 '16 at 7:31
  • $\begingroup$ can you show the image/screenshot of what you are getting with Grid[] $\endgroup$ – Sumit May 29 '16 at 9:06
2
$\begingroup$

Here is a kick --- sunday --- answer

 p1 := Plot[Sin[x], {x, 0, 1}]
 p2 := Plot[Cos[x], {x, 0, 1}]
 GraphicsGrid[{{p1}, {p2}}]
 Export["Where you want\\name of the file", pasted GraphicsGrid]

You may copy the GraphicsGrid on clicking on the vertical bar

$\endgroup$
  • $\begingroup$ Yes. copying from vertical bar worked. Thanks, $\endgroup$ – Benjamin May 29 '16 at 21:50
  • $\begingroup$ What is the format of "Where you want\\name of the file" if it's named "myplot" and it is in my "desktop" under "U of A" user? $\endgroup$ – Benjamin May 29 '16 at 21:58
  • $\begingroup$ Sorry I have not seen the add earlier. I do not know on what system you work. I work on windows so Where ou whant is the path where you want to save your file and name of the file to remember that you may chose the name and the format --- jpg, png, eps... $\endgroup$ – cyrille.piatecki May 31 '16 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.