5
$\begingroup$

In few words, I would make this graph:

enter image description here

My many problems are the following:

How do I plot a vertical line? What's the equation?

How do I add the letters on the lines?

How to make the Ticks like $P_0$ $P_1$ and so on?

Thank you very much for the help!

$\endgroup$

closed as off-topic by Alexey Popkov, Fraccalo, MarcoB, Carl Lange, Alex Trounev Oct 23 at 19:19

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Alexey Popkov, Fraccalo, MarcoB, Carl Lange, Alex Trounev
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ You may want to use Graphics and just draw lines that look that way. Don't see why you would want to model this with equations. $\endgroup$ – C. E. Oct 21 at 10:36
  • $\begingroup$ Perhaps you just want the drawing tools. $\endgroup$ – Alan Oct 21 at 12:53
6
$\begingroup$

Try this:

Show[{
  Graphics[{Line[{{1, 2}, {3, 2}}], Line[{{3, 2}, {3, 1}}]}, 
   PlotRange -> {{-0.10, 4}, {-0.1, 2.5}}, Axes -> True, 
   AxesStyle -> Arrowheads[0.03], 
   Ticks -> {{{1, 
       Style["\!\(\*SubscriptBox[\(T\), \(0\)]\)", Italic, 16, 
        Black]}, {3, 
       Style["\!\(\*SubscriptBox[\(T\), \(1\)]\)", Italic, 16, 
        Black]}}, {{1, 
       Style["\!\(\*SubscriptBox[\(P\), \(1\)]\)", Italic, 16, 
        Black]}, {2, 
       Style["\!\(\*SubscriptBox[\(P\), \(2\)]\)", Italic, 16, 
        Black]}}}, 
   AxesLabel -> {Style["T(K)", 16, Italic, Black], 
     Style["P(Pa)", 16, Italic, Black]}],

  Graphics[{Text[Style["A", Black, 16], {1, 2.15}], 
    Text[Style["B", Black, 16], {3, 2.15}], 
    Text[Style["C", Black, 16], {3.15, 1}]}]

  }]

with the effect

enter image description here

To my taste this is more straightforward than to draw it by equations.

However, you definitely can draw these lined using standard Plot-family functions. Consider, for example, this:

Show[{
  ParametricPlot[{1, y}, {y, 0.5, 2}, 
   PlotRange -> {{0, 2.5}, {0, 2.5}}],
  ParametricPlot[{x, 1}, {x, 0.5, 2}]
  }]

yielding

enter image description here

Have fun!

$\endgroup$
  • $\begingroup$ Wow that is wondrous!! Thank you so much! $\endgroup$ – Henry Oct 21 at 16:51
8
$\begingroup$

ListPlot

coords = {{1, 2}, {3, 2}, {3, 1}};

labeledcoords = MapThread[Labeled, 
    {coords, {"A", "B", "C"}, {Above, Above, Below}}];

ListLinePlot[labeledcoords, 
  PlotRange -> {{0, 4}, {0, 3}}, 
  AxesLabel -> {T[k], P[Subscript[p, a]]}, 
  AxesStyle -> Arrowheads[.03],
  Ticks -> {Thread[{{1, 3}, Subscript[T, #] & /@ {1, 2}}], 
      Thread[{{1, 2}, Subscript[P, #] & /@ {1, 2}}]}]

enter image description here

To get a hand-drawn look use Simon Woods' xkcdConvert:

 xkcdConvert @ %

enter image description here

Graphics

Graphics[{Thick, Line[Partition[coords, 2, 1]], 
    MapThread[Text, {Style[#, 14] & /@ {"A", "B", "C"}, 
        coords , {{0, -1}, {0, -1}, {0, 1}}}]}, 
  PlotRange -> {{0, 4}, {0, 3}}, Axes -> True, AxesOrigin -> {0, 0}, 
  AxesLabel -> {T[k], P[Subscript[p, a]]}, 
  AxesStyle -> Arrowheads[.03], 
  Ticks -> {Thread[{{1, 3}, Subscript[T, #] & /@ {1, 2}}], 
      Thread[{{1, 2}, Subscript[P, #] & /@ {1, 2}}]}]

enter image description here

ParametricPlot

ClearAll[f]
f[x_?NumericQ] := Piecewise[{ {2, 1 <= x < 3}, {1, x == 3}}, Undefined]

ParametricPlot[{x, f[x]}, {x, 1, 3}, 
  PlotRange -> {{0, 4}, {0, 3}}, AxesOrigin -> {0, 0},
  AxesLabel -> {T[k], P[Subscript[p, a]]}, 
  AxesStyle -> Arrowheads[.03], PlotStyle -> Black,
  Ticks -> {Thread[{{1, 3}, Subscript[T, #] & /@ {1, 2}}], 
      Thread[{{1, 2}, Subscript[P, #] & /@ {1, 2}}]},
  Epilog -> MapThread[Text, 
   {Style[#, 14] & /@ {"A", "B", "C"}, coords, {{0, -1}, {0, -1}, {0, 1}}}]]

enter image description here

$\endgroup$
  • 3
    $\begingroup$ The famous code "xkcdConvert" was remembered again. It's amazing. $\endgroup$ – LCarvalho Oct 21 at 14:00

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