-2

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?

sky-light
  • 827
  • 1
  • 12
  • 24
  • 1
    Did you have a look at Show? – C. E. Nov 04 '13 at 18:00
  • Like @Anon said Show should do the trick if I understand your question. Please elaborate on your problem. – Rene Duchamp Nov 04 '13 at 19:21
  • @abhilashsukumari Yes I know Show command. but this command is for the case when you have both result in the same program. but in my case I have two different programs, so I can't say Show[Plot1, Plot2] – sky-light Nov 04 '13 at 19:33
  • 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 04 '13 at 20:02
  • @JasonB I am doing simulation of different systems, for each system there is its own equations and calculations. I use Mathematica for both calculation and plotting. I usually do several steps of calculations then plotting the results. So, I have different notebooks. It is not possible that I put all programs in the same notebook. Even if I put programs in the same notebook I can't run them simulatanously. – sky-light Nov 04 '13 at 21:01
  • In MatLab it is very easy, you can copy and paste the plotting. and it will copy the legend too. But I don't know how to do that in Mathematica. – sky-light Nov 04 '13 at 21:03
  • 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 04 '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: http://mathematica.stackexchange.com/questions/17250/is-it-possible-to-change-the-color-of-plot-in-show – Jason B. Nov 04 '13 at 23:58

1 Answers1

3
(*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]
Dr. belisarius
  • 115,881
  • 13
  • 203
  • 453