Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two different programs for simulating a system. when I get the results I have plotting result for each. now I want to combine both drawings so that I compare between them. I want to put both of them on the same picture. How I can do that? for example; I will attach two drawings. enter image description here enter image description here

my second question is that how to change the color of the line after drawing?

share|improve this question
Did you have a look at Show? – C. E. Nov 4 '13 at 18:00
Like @Anon said Show should do the trick if I understand your question. Please elaborate on your problem. – abhilash sukumari Nov 4 '13 at 19:21
@barznjy, what do you mean by having two different programs? Did you use mathematica to create the plots, or another program? You don't have all of the data accessible in a single notebook? Do you still have the data, or just the plots? – JasonB Nov 4 '13 at 20:02
@barznjy, What is the result when you try to do exactly that in Mathematica? Open the two notebooks that have the plots in them (call them notebooks 1 and 2), then open a new notebook (notebook 3). Highlight the plot from notebook 1 and hit copy. Go into notebook 3, type g1= then hit paste, and enter. Do the same with notebook 2, naming that graphic g2. Finally, just enter Show[g1,g2]. You should get what you want. – JasonB Nov 4 '13 at 21:20
@barznjy I do agree that you have to better state your question, but I just assumed this was a non-native English problem. Here, the most descriptive title for your question would be "How can I combine two plots that were created in different notebooks". That can help us to figure out how to help you. Also, I just noticed that there was a second question, concerning how to change the colors of the plots after you've created them. The answer can be found here:… – JasonB Nov 4 '13 at 23:58
(*let's simmulate your environment*)

(*First we create a notebook*)
nb1 = CreateDocument[ExpressionCell[Defer[p1 = Plot[Sin[x], {x, 0, 2 Pi}]], "Input"]];
(* The another one *)
nb2 = CreateDocument[ExpressionCell[Defer[p2 = Plot[Cos[x], {x, 0, 2 Pi}]], "Input"]];
DialogInput[ DialogNotebook[{TextCell[
               "We have created two NBs (Check the open windows) \n Press OK to calculate both NBs"], 
             Button["OK", DialogReturn[]]}]];
NotebookEvaluate[nb1, InsertResults -> True];
NotebookEvaluate[nb2, InsertResults -> True];
   "Now we have evaluated both Notebooks \n Press OK to close the Nbs and show both plots together"], 
                Button["OK", DialogReturn[]]}]]
NotebookClose /@ {nb1, nb2};
Show[p1, p2]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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