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 defined two function like f[Rp_] := Sin[0.5 ArcSin[Sqrt[(3 Rp^2)/((2 - Rp)^2 + 3 Rp^2)]]] and f[Rm_] := Sin[0.5 ArcSin[Sqrt[(3 Rm^2)/((2 + Rm)^2 + 3 Rm^2)]]].


Plotting them as Plot[(2/Sqrt[6]) f[Rp] (2/Sqrt[6]) f[Rp], {Rp, 0.0, 1.3}, PlotRange -> {{0, 1.3}, {0, .23}}, Frame -> True, FrameLabel -> {d/a, Subscript[Sin\[Theta], 13]}, PlotStyle -> Directive[Red, Thick], LabelStyle -> Directive[Black, Bold]]


and Plot[(2/Sqrt[6]) f[Rm], {Rm, 0.0, 1.3}, PlotRange -> {{0, 1.3}, {0, .23}}, Frame -> True, FrameLabel -> {d/a, Subscript[Sin\[Theta], 13]}, PlotStyle -> Directive[Red, Thick], LabelStyle -> Directive[Black, Bold]]


The outputs are as follows..... Mismatch between Axes -> True and Frame ->True


Now, How can I combine them, I've tried with Plot[{(2/Sqrt[6]) f[Rp], (2/Sqrt[6]) f[Rm]}, {Rm, Rp, 0.0, 1.3}, PlotRange -> {{0, 1.3}, {0, .23}}, Frame -> True, FrameLabel -> {d/a, Subscript[Sin\[Theta], 13]}, PlotStyle -> Directive[Red, Thick], LabelStyle -> Directive[Black, Bold]]

But I'm not getting properly. Probably I'm making mistake in {Rm, Rp, 0.0, 1.3}.

share|improve this question

closed as too localized by Yves Klett, Sjoerd C. de Vries, Artes, Ajasja, whuber May 9 '13 at 19:37

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
The brute force method would be to store the two functioning outputs in variables ` plot1 = Plot[(2/Sqrt[6]) f[Rp] (2/Sqrt[6]) f[Rp], {Rp, 0.0, 1.3}, PlotRange -> {{0, 1.3}, {0, .23}}, Frame -> True, FrameLabel -> {d/a, Subscript[Sin[Theta], 13]}, PlotStyle -> Directive[Red, Thick], LabelStyle -> Directive[Black, Bold]] ` plot2 would be made the same way and then use ` Show[{plot1, plot2}] ` I'm confused by why you are making two identical functions, however. –  bobthechemist May 9 '13 at 13:58
    
Plot[{Sin[x], Sin[2 x], Sin[3 x]}, {x, 0, 2 Pi}, PlotLegends -> "Expressions"] is the second example in the help ffile for Plot. Mimic it. –  bill s May 9 '13 at 13:58
    
What are you trying to do? You have defined the function f twice. –  bill s May 9 '13 at 14:01
    
@bobthechemist, Two functions are different. f[Rp_] contains (2 - Rp) term where as f[Rm_] contains (2 + Rm) term. I have used 'Show[{plot1, plot2}]' and its works. Now how to fill the spaces between the curves like the code 'Filling -> {1 -> {{2}, Green}' in this case. –  Biswajit May 9 '13 at 14:12
    
Thanks @bills, I got it now. I made mistake in defining the functions. –  Biswajit May 9 '13 at 15:07
show 1 more comment

1 Answer 1

up vote 2 down vote accepted

Bill s is right, you have simply overwritten the definition of f. The code below will show the two plots in one image.

f1[Rp_] := Sin[0.5 ArcSin[Sqrt[(3 Rp^2)/((2 - Rp)^2 + 3 Rp^2)]]]
f2[Rp_] := Sin[0.5 ArcSin[Sqrt[(3 Rp^2)/((2 + Rp)^2 + 3 Rp^2)]]]

plot1 =
 Plot[(2/Sqrt[6]) f1[Rp], {Rp, 0.0, 1.3}, 
  PlotRange -> {{0, 1.3}, {0, .23}}, Frame -> True, 
  FrameLabel -> {d/a, Subscript[Sin[\[Theta]], 13]}, 
  PlotStyle -> Directive[Red, Thick], 
  LabelStyle -> Directive[Black, Bold]]



plot2 = Plot[(2/Sqrt[6]) f2[Rp], {R, 0.0, 1.3}, 
  PlotRange -> {{0, 1.3}, {0, .23}}, Frame -> True, 
  FrameLabel -> {d/a, Subscript[Sin\[Theta], 13]}, 
  PlotStyle -> Directive[Red, Thick], 
  LabelStyle -> Directive[Black, Bold]]

Show[plot1, plot2]

For filling the spaces between the curves


Plot[{(2/Sqrt[6]) f2[Rp], (2/Sqrt[6]) f1[Rp]}, {Rp, 0.0, 2.0}, 
 PlotRange -> {{0, 2.0}, {0, .4}}, Frame -> True, 
 FrameLabel -> {d/a, Subscript[Sin\[Theta], 13]}, 
 PlotStyle -> Directive[Blue], Filling -> {1 -> {{2}, Pink}}, 
 LabelStyle -> Directive[Black, Bold]]
share|improve this answer
    
Plot[{(2/Sqrt[6]) f1[x] (2/Sqrt[6]) f1[x], (2/Sqrt[6]) f2[x]}, {x, 0.0, 1.3}, PlotRange -> {{0, 1.3}, {0, .23}}, Frame -> True, FrameLabel -> {d/a, Subscript[Sin[[Theta]], 13]}, PlotStyle -> Directive[Red, Thick], LabelStyle -> Directive[Black, Bold], Filling -> {1 -> {{2}, Green}}] should give the filling you are looking for –  bobthechemist May 9 '13 at 14:31
    
Thank a lot @bobthechemist –  Biswajit May 9 '13 at 15:14
    
Thanks a lot @Jacob Akkerboom. Thank you all. Got my answer. –  Biswajit May 9 '13 at 15:16
    
@BiswajitKarmakar no problem. Sorry you got downvoted. –  Jacob Akkerboom May 9 '13 at 15:30
    
@bobthechemist Thanks for editing. I would approve, but as it is it your code will produce a beep because it does not like Sin[Theta]. Also I think the formatting of the code doesn't work. –  Jacob Akkerboom May 9 '13 at 15:32
show 3 more comments

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