-2

PV-diagram of an isotherm with some segments of adiabats

How can I recreate such a diagram? with the line segments and not necessarily with the points (V_2, P_5, T_5), ..., etc.

6
  • Is this post helpful? tex.stackexchange.com/a/706978/267375
    – Tom
    Feb 1 at 4:25
  • Yes! I think this is good however, missing the line segments I need the most. Feb 1 at 4:37
  • You're unlikely to find an answer that has everything you're looking for. There are plenty of online resources that you can use to learn the basics of TikZ and PGFPlots (e.g., the packages' documentation). I highly recommend that you do learn the basics so that you can add the line segments yourself.
    – bonk
    Feb 1 at 5:05
  • Welcome to TeX.SE! My 2-cents would be to study the pgfplots package; specifically, the axis environment and the \addplot command. Check out Dr. Trefor Bazett on YouTube too. I recommend this retrospectively, as I wish I has received advice like this when I was just beginning with TikZ. :) (Just studying the TikZ manual without guidance can be quite dry)
    – user279206
    Feb 1 at 5:19
  • 1
    @Pseudonym123 Yess! I actually started using latex after I watched his first and second tutorials; amazing. I think I have watched his TikZ video.. i might want to rewatch it. Thanks anyways. Feb 1 at 19:04

1 Answer 1

1

As some comments stated, we'd like to see your own attempts here, first. However, because this diagram involves some interesting aspects, I'll sketch a path towards your final diagram. BTW, this is more or less the procedure to come up with drawings.

Where to find more

I suggest to skim through or read the tutorial sections in the Tikz manual, either as html of pdf. Also look up all relevant Tikz-commands I'm using.

Basic idea

Let's have a look at the basic idea first:

  • draw the axes
  • draw the lower curve
  • indicate points needed for your dottings
  • connect points above the lower curve

Axes: nothing strange her ... just draw them.

    % ~~~ axes ~~~
    \draw[->] (0,0) -- (5,0);
    \draw[->] (0,0) -- (0,5);

Now, the lower curve seems to be complicated, while it's not when you understood the path-concept of Tikz. Basically you draw a line between two points \draw (1,3) -- (4,1); . To make it curved, as one way to do it just replace -- by to[out=,in=] and specify the outgoing and incoming angles. The path starts with \draw and ends with ; . So let's do a bit more actions on this path before it ends. Put a node after the last coordinate drawn to put the T1 label. Insert two more nodes between start and end point, where we only will use their coordinates (A) and (B) and fine tune their position on this path by using [pos=]. Kindly watch the dropped \ inside the path.

    % ~~~ lower curve: a path with many actions ~~~~~   
    \draw (1,3) to[out=-60,in=170]  % start point, towards ...
    node[pos=.8] (A) {A}            % basically, store coordinates
    node[pos=.6] (B) {B}            % (A) and (B)
    (4,1) node[anchor=west]{$T_1$}  % end point + some node as label    
    ;                               % end of this path

We need an other point (C) above (B), so let's put another \node, using a [yshift=]

    % ~~~ put a node//coordinate above (B) ~~~
    \node (C) at ([yshift=6mm]B) {C};

Finally, let's connect (A), (C) and (B), again with some curved line:

    % ~~~ connect A, C and B ~~~~~~~~~
    \draw (A) to[out=140,in=-70] (C) -- (B);

basicIdea

Refinements

These are the changes and add-ons:

  • define some styles: crd to render the dummy nodes with circles, ln for the line
  • remember coordinate (X) along the x-axis for later
  • remove text from nodes A, B and C AND use the crd style
  • draw with arrow and label for the (label)
  • calculate coordinate (V4) under (B) reusing (X), put a \node, \draw a tick

For the shifted arrow in your line there are several ways to do it. I used the lazy variant, and here are further options:

  • omitting the arrow
  • using the decorations library
  • put an intermediate point between A and B (and adjust the angles, if needed)
  • etc.

refinements

Complete code

This code will create two pages (one for each tikzpicture environment) of drawings with adjusted page geometry.

\documentclass[10pt,border=3mm,tikz]{standalone}

\begin{document}
 % ~~~ (I) basic ideas ~~~~~~~~~~~~~~~
 \begin{tikzpicture}
    % ~~~ axes ~~~
    \draw[->] (0,0) -- (5,0);
    \draw[->] (0,0) -- (0,5);
    
    % ~~~ lower curve: a path with many actions ~~~~~   
    \draw (1,3) to[out=-60,in=170]  % start point, towards ...
    node[pos=.8] (A) {A}            % basically, store coordinates
    node[pos=.6] (B) {B}            % (A) and (B)
    (4,1) node[anchor=west]{$T_1$}  % end point + some node as label    
    ;                               % end of this path
    
    % ~~~ put a node//coordinate above (B) ~~~
    \node (C) at ([yshift=6mm]B) {C};
    
    % ~~~ connect A, C and B ~~~~~~~~~
    \draw (A) to[out=140,in=-70] (C) -- (B);
    
 \end{tikzpicture}
 
 
 
 % ~~~ (II) fine print ~~~~~~~~~~~~~~~
 \begin{tikzpicture}[   % some self-defined styles
    crd/.style={minimum size=1mm,       % puts the dots
                inner sep=0pt,circle,draw,fill},
    ln/.style={blue, line width=1.5pt},
 ]
    % ~~~ axes ~~~
    \draw[->] (0,0) -- (5,0) coordinate (X);
    \draw[->] (0,0) -- (0,5);
    
    % ~~~ lower curve: a path with many actions ~~~~~   
    \draw (1,3) to[out=-60,in=170]  % start point, towards ...
    node[pos=.8,crd] (A) {}         % basically, store coordinates
    node[pos=.6,crd] (B) {}         % (A) and (B)
    (4,1) node[anchor=west]{$T_1$}  % end point + some node as label    
    ;                               % end of this path
    
    % ~~~ put a node//coordinate above (B) ~~~
    \node[crd] (C) at ([yshift=6mm]B) {};
    
    % ~~~ connect A, C and B ~~~~~~~~~
    \draw[ln,->] (A) to[out=140,in=-70] (C);
    \draw[ln]    (C) -- (B);
    
    % ~~~ put some label ~~~~~~~~~~~
    \draw[<-] (C) -- +(45:15mm) node[anchor=west] {$(V_4, P_4, T_4)$};
    
    % ~~~ perpendicular below points ~~~~~~~
    \coordinate           (V4) at (B |- X); % projection onto x-axis
    \node[yshift=-3mm] at (V4) {$V_4$};     % the label
    \draw (V4) -- +(0,.2);                  % the tick
    
 \end{tikzpicture}
\end{document}
3
  • 1
    Such a nice and clean explanation :-D
    – MadyYuvi
    Feb 1 at 12:25
  • Thank you, @MadyYuvi
    – MS-SPO
    Feb 1 at 12:44
  • 1
    Oh wow! that's quite good, thank you very much. Feb 1 at 19:05

Not the answer you're looking for? Browse other questions tagged .