3
$\begingroup$

I have a list of points that I want to a plot, but I can't figure out how to do it with Epilog.

Here's the code I have so far:

Gammaconst = 1.67; 
Pa = 975.452; Pb = 975.452; Pc = 384.269; Pd = 384.269;
Ta = 355; Tb = 355; Tc = 295; Td = 295;
R = 8.3144; n = 0.000137;
V1 = 4.97*(10^-6); V2 = 2.736*(10^-5); V3 = 2.902*(10^-5); V4 = 
 6.63*(10^-6);
P[V_, T_] := n*R*T/V;
Plot [{P[V, T = 355], P[V, T = 295]}, {V, 0.000005, 0.00003
  }, AxesOrigin -> {0, 0}, 
 AxesLabel -> {"Volume (\!\(\*SuperscriptBox[\(m\), \(3\)]\))", 
   "Pressure (Pa)"},
 Epilog -> {Line[{{V1, P[V1, 355]}, {V4, P[V4, 295]}}],
   Line[{{V3, P[V3, 295]}, {V2, P[V2, 355]}}]}]
Plot[{{V1, 101325 - Pa}, {V2, 101325 - Pb}}, 
 PlotStyle -> PointSize[0.015]]

I get a nice graph and I want to mark a few points on it to show where they are. After the first Plot command is a second plot containing the points I was testing with. I get an error mesage that says

"PLot called with one argument, two expected."

I am now utterly convinced that the people who write error messages don't want anyone to understand them.

Sorry, but this is just frustrating as all getout because the whole thing should take an hour and I have been messing with this all bloody day.

$\endgroup$
3
  • $\begingroup$ Your points are here for me. Looks weird, but is it what you want? $\endgroup$
    – Öskå
    May 23, 2014 at 13:20
  • $\begingroup$ Cose. I was trying to illustrate the points that I measured in a lab against a "perfect" carnot cycle, and show the difference. It's possible I wasn't seeing them, but did you arrange the code the same way? Is there something I am doing wrong? $\endgroup$
    – Jesse
    May 23, 2014 at 13:28
  • $\begingroup$ The error message is clear. Plot requires two arguments: the first being an expression the gives a function of one variable to be plotted and the second being a range specification for that variable. Your second Plot expression provides it with neither. $\endgroup$
    – m_goldberg
    May 23, 2014 at 13:53

1 Answer 1

7
$\begingroup$

You just need to use Point within Epilog:

Plot[{P[V, T = 355], P[V, T = 295]}, {V, 0.000005, 0.00003}, 
  AxesOrigin -> {0, 0}, 
  AxesLabel -> {"Volume", "Pressure (Pa)"},
  Epilog -> {       
    Line[{{V1, P[V1, 355]}, {V4, P[V4, 295]}}], 
    Line[{{V3, P[V3, 295]}, {V2, P[V2, 355]}}],
    Point /@ {{V1, 101325 - Pa}, {V2, 101325 - Pb}}},
 PlotRange -> {Automatic, {0, 101325}}]

Or you can plot two different things and Show them:

p = Plot[{P[V, T = 355], P[V, T = 295]}, {V, 0.000005, 0.00003}, 
  AxesOrigin -> {0, 0}, 
  AxesLabel -> {"Volume", "Pressure (Pa)"}, 
  Epilog -> {        
    Line[{{V1, P[V1, 355]}, {V4, P[V4, 295]}}], 
    Line[{{V3, P[V3, 295]}, {V2, P[V2, 355]}}]
    },
  PlotRange -> {Automatic, {0, 101325}}];
lp = ListPlot[{{V1, 101325 - Pa}, {V2, 101325 - Pb}}];
Show[{p, lp}, PlotRange -> All]

Mathematica graphics

$\endgroup$
10
  • $\begingroup$ thanks this was one of those thing that was really frustrating and should illustrate why if you like coding yo need a high frustration tolerance. :-) $\endgroup$
    – Jesse
    May 23, 2014 at 13:51
  • $\begingroup$ oh, the /@ -- is that the same as a bracket or something? I have never seen that. $\endgroup$
    – Jesse
    May 23, 2014 at 13:54
  • $\begingroup$ ok, by the way when I tried adding a third point i get an error message again. I tried fixing th ebrackets and now the range is too small again (like it doesn't see the Plotrange command arrrrggh $\endgroup$
    – Jesse
    May 23, 2014 at 14:00
  • 3
    $\begingroup$ Surgeon General's Warning: Accepting without upvoting causes halitosis and genital warts $\endgroup$ May 23, 2014 at 14:03
  • 1
    $\begingroup$ {..,Line[],[email protected],Point/@..} $\endgroup$
    – Öskå
    May 23, 2014 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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