# Plotting Cross section in a phase diagram

α2 = 1/2 (κ2 + 2 η2) + I (δ0 - β2 I2);
α1 = 1/2 (κ1 - 2 η1) + I (δ0 - β1 I1);


I would like to plot a cross-section for different values of δ2 but could get the output, any comments would be greatly appreciated.

I2 = x*10^12;
I1 = y*10^12;

P = (h ν2a)/(2 κ2a) I2 Abs[α2]^2;

ListPlot[{Table[{(P /. δ2 -> 4 π)*10^12, I2/10^10}, {x, 0,
0.1, 0.0001}],
Table[{(P /. δ2 -> 0)*10^12, I2/10^10}, {x, 0, 0.1, 0.0001}],
Table[{(P /. δ2 -> 6 π)*10^12, I2/10^10}, {x, 0, 0.1,
0.0001}]}, PlotRange -> {{0, 0.042}, {0, 1.8}}, Frame -> True,
FrameLabel -> {"P(pW)",
"\!$$\*SubscriptBox[\(I$$, \
$$2$$]\)\[Cross]\!$$\*SuperscriptBox[\(10$$, $$12$$]\)"},
FrameStyle -> Directive[19, Black], Joined -> True,
AspectRatio -> 1.3, ImageSize -> 250,
PlotStyle -> {{Black, Thick, DotDashed}, {Blue, Thick, Dashed}, {Red,
Thick}}, ImageSize -> 300]

• Please find a short, simple example of your problem, if possible. Commented Dec 23, 2016 at 9:57
• @– C. E, the code takes few seconds to run Commented Dec 23, 2016 at 10:12
• I ran it but it produced a blank plot, and now I have to read to code to understand what you were trying to do. I still haven't looked at it, but in my experience it usually boils down to something I've seen before. It is always appreciated when people simplify problems as much as possible (without all the constants etc.) because then one can often spot what the problem is without much effort at all. And then someone is more likely to help. Maybe it's not possible for this problem. Commented Dec 23, 2016 at 10:29
• @– C. E. yeah, I even got the a blank plot Commented Dec 23, 2016 at 10:30

If you look at P you will see it is a list instead of a scalar. At some point in its definition something has returned as a list and this has made its way through P.

You could First P, First@P /. δ2 -> 4 π , wherever it is used. This will get you the ListPlot; you could just Plot it instead of all the Table bits. However, you should probably work through its definition to find out how it became a list as there could be other issues as a result.

Hope this helps.

• Win by seconds :). You can also use P = First[(h ν2a)/(2 κ2a) I2 Abs[α2]^2]; Commented Dec 23, 2016 at 10:51
• @Sumit Whoops, I ment First. LOL Commented Dec 23, 2016 at 10:53
• @Sumit & Edmund, It works perfectly with what I was looking for!!! Commented Dec 23, 2016 at 12:37
• @Sumit, there is a fellow up question: If I now modify the δ1 and δ2 equal to δ0 and I1 = I2 Abs[Conjugate[[Alpha]2] + [Mu] [Eta]3]^2/ Abs[[Mu] (-I [Delta]0 + [Kappa]1/2 - [Eta]1) - [Eta]7]^2 with P = 0.8 P1 and the new parameter [Mu]=0.1. Commented Jan 10, 2017 at 6:33
• @DavidH, ummm, what is the problem? Commented Jan 10, 2017 at 9:20

Other way to fix that is:

 ListPlot[{
Map[Flatten, Table[{(P /. \[Delta]2 -> 4 \[Pi])*10^12, I2/10^10}, {x, 0, 0.1, 0.0001}]],
Map[Flatten, Table[{(P /. \[Delta]2 -> 0)*10^12, I2/10^10}, {x, 0, 0.1, 0.0001}]],
Map[Flatten, Table[{(P /. \[Delta]2 -> 6 \[Pi])*10^12, I2/10^10}, {x, 0, 0.1, 0.0001}]]},
PlotRange -> {{0, 0.042}, {0, 1.8}},
Frame -> True, FrameLabel -> {"P(pW)", "\!$$\*SubscriptBox[\(I$$, \
$$2$$]\)\[Cross]\!$$\*SuperscriptBox[\(10$$, $$12$$]\)"},
FrameStyle -> Directive[19, Black], Joined -> True, AspectRatio -> 1.3, ImageSize -> 250,
PlotStyle -> {{Black, Thick, DotDashed}, {Blue, Thick, Dashed}, {Red, Thick}}, ImageSize -> 300]