-1
$\begingroup$

I want to plot more than one plot in a single frame for the following syntax. I'm not getting how to do it. Kindly guide me.

xi = 0.5;
Plot[Im[y], {k, 0, 100}, PlotRange -> All, PlotStyle -> {Red, Thick}, 
 AxesLabel -> {"k", 
   "\!\(\*SubscriptBox[\(Ω\), \(i\)]\)"}, Frame -> True,
  FrameStyle -> Thick, 
 PlotLegends -> {"k", 
   "\!\(\*SubscriptBox[\(Ω\), \(i\)]\)"}]

xi = 10;
Plot[Im[y], {k, 0, 100}, PlotRange -> All, 
 PlotStyle -> {Black, Dashed, Thick}, 
 AxesLabel -> {"k", 
   "\!\(\*SubscriptBox[\(Ω\), \(i\)]\)"}, Frame -> True,
  FrameStyle -> Thick, 
 PlotLegends -> {"k", 
   "\!\(\*SubscriptBox[\(Ω\), \(i\)]\)"}]

xi = 1000;
Plot[Im[y], {k, 0, 100}, PlotRange -> All, 
 PlotStyle -> {Blue, Thick, Dashed}, 
 AxesLabel -> {"k", 
   "\!\(\*SubscriptBox[\(Ω\), \(i\)]\)"}, Frame -> True,
  FrameStyle -> Thick, 
 PlotLegends -> {"k", 
   "\!\(\*SubscriptBox[\(Ω\), \(i\)]\)"}]
```
$\endgroup$

2 Answers 2

3
$\begingroup$

You can use Show to combine multiple plots:

plot1 = Plot[Sin[3 x], {x, -Pi, Pi}, PlotStyle -> Dashed]

and

plot2 = Plot[Sin[2 x]*Cos[x], {x, -Pi, Pi}, PlotStyle -> Red]

then

Show[{plot1, plot2}]

delivers: enter image description here

$\endgroup$
2
$\begingroup$

Since you didn't provide y I made one up. You can combine them all into a single Plot and use Directive. I also took the liberty of changing AxesLabel to FrameLabel and disabling RotateLabel and adding the legends.

y = k^3/2 + I Log[k + 1]/Sqrt[xi];

Plot[{Im[y] /. {xi -> .5}, Im[y] /. xi -> 10, 
 Im[y] /. xi -> 1000}, {k, 0, 100},
 PlotRange -> All,
 PlotStyle -> {
   Directive[Red, Thick],
   Directive[Black, Dashed, Thick],
   Directive[Blue, Thick, Dashed]
 },
 Frame -> True,
 FrameStyle -> Thick,
 PlotLegends -> {"k for \[Xi] == 0.5", "k for \[Xi] == 10", "k for \[Xi] == 1000"},
 FrameLabel -> {"k", "\!\(\*SubscriptBox[\(\[CapitalOmega]\), \(i\)]\)"}, 
 RotateLabel -> False]

multiple plots with styles frame and legend

$\endgroup$
5
  • $\begingroup$ Sir, I tried to add the Framelevel in the 3d plot but it shows error. How can I get the Framelevel in 3d plot. AxesLevel and PlotLegends also does not get execute properly. It shows the level for x axis but does not show the level for y axis. Plot3D[Im[y], {xi, 0.1, 10}, {k, 10, 100}, PlotRange -> All, BoundaryStyle -> Directive[Red, Thick], PlotLegends -> {"[Xi]", "k"}, AspectRatio -> 0.5] $\endgroup$ Commented Jun 5, 2020 at 3:26
  • $\begingroup$ FrameLevel? I assume you mean FrameLabel. This is not an option for Plot3D but you should use AxesLabel->{xi,k,Subscript[Ω,i]} . Also don't use AspectRatio in Plot3D, use BoxRatios instead. $\endgroup$
    – flinty
    Commented Jun 5, 2020 at 12:10
  • $\begingroup$ Sir, in Plot3D it does not show me the PlotLegends properly. It only shows the first parameter passed, the other two parameter gets hidden.I'm using Plot3D[Im[y], {xi, 0.1, 10}, {k, 10, 100}, PlotRange -> All, BoundaryStyle -> Directive[Red, Thick], AxesLabel -> {[Xi], k, Subscript[[CapitalOmega], i]}, PlotLegends -> {"[Xi]", "k", "\!(*SubscriptBox[([CapitalOmega]), (i)])"}, Mesh -> {{0}}, BoxRatios -> {1, 1, 1}].When I run this code I get only Xi but not the other two. $\endgroup$ Commented Jun 14, 2020 at 4:05
  • $\begingroup$ @RahulChakraborty Plot3D? That's a different question altogether. $\endgroup$
    – flinty
    Commented Jun 14, 2020 at 10:54
  • $\begingroup$ No Sir, same topic continuing, so far all queries related to plot3d only I have asked. $\endgroup$ Commented Jun 14, 2020 at 16:25

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