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?

  • 1
    $\begingroup$ Did you have a look at Show? $\endgroup$ – C. E. Nov 4 '13 at 18:00
  • $\begingroup$ Like @Anon said Show should do the trick if I understand your question. Please elaborate on your problem. $\endgroup$ – Rene Duchamp Nov 4 '13 at 19:21
  • 1
    $\begingroup$ @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? $\endgroup$ – Jason B. Nov 4 '13 at 20:02
  • 1
    $\begingroup$ @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. $\endgroup$ – Jason B. Nov 4 '13 at 21:20
  • 2
    $\begingroup$ @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/… $\endgroup$ – Jason B. 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]
| improve this answer | |

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.