Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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
1  
Did you have a look at Show? –  Pickett 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
1  
@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? –  Jason B Nov 4 '13 at 20:02
1  
@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. –  Jason B Nov 4 '13 at 21:20
2  
@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: mathematica.stackexchange.com/questions/17250/… –  Jason B Nov 4 '13 at 23:58

1 Answer 1

(*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"]];
(*pause*)
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];
DialogInput[
 DialogNotebook[{TextCell[
   "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

 
discard

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.