我想绘制安德鲁斯等温线

我想绘制安德鲁斯等温线

我想要绘制类似于这样的安德鲁斯等温线:

在此处输入图片描述

重要的一点是,我可以用颜色或图案“标记”区域 I、II、III 和 IV。

我已经用此代码尝试了两件事:

    \documentclass{article}
\usepackage{tikz}

\usepackage{tkz-euclide}
\usetikzlibrary{calc, shadings, arrows.meta}
\usepackage{tkz-euclide}

\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{decorations.text}



\begin{document}



\begin{center}
\begin{tikzpicture}[domain=0:15, scale=0.5, >=latex]
  \coordinate (A) at (14,1) ;
  \coordinate (C) at (9,5) ;
  \coordinate (E) at (2,5) ;
  \coordinate (F) at (1.6,10);
  \tkzLabelPoints[above right](A,E,F) 
  \node[anchor=north] at (0.5,0) {\tiny {vloeistof}};
  \node[anchor=north] at (13,4) {\tiny {onverzadigde damp}};
  \draw[->] (-0.1,0) -- (15.7,0) node[right] {{\tiny $V$}};
  \draw[->] (0,-0.1) -- (0,10.7) node[left] {{\tiny $p$}};
  \draw[very thick] (A) to[out=170,in=-70] (C);
  \draw[very thick] (E) -- (C);
  \draw[very thick] (F) -- (E);
  \tkzDrawPoints[size=10pt](C);
  \tkzLabelSegment[below,color=orange](C,E){\tiny{verzadigde damp + vloeistof}}; 
  \tkzLabelSegment[above,color=green,sloped](E,F){\tiny{vloeistof}}; 
  \tkzLabelPoint[above right,](C){\tiny{C: gas in kritische toestand}};

\end{tikzpicture}
\end{center}

\vspace{3cm}

\begin{center}
\begin{tikzpicture}
\begin{axis}[%
major grid style=gray,
title= Sublimatielijn,
axis lines=center,
ymin=0,
ymax=1400,
xmin=0, xmax=120,
xtick={0,20,...,120},
ytick={0,200,...,1400},
tick label style={font=\small},
width=\linewidth,
height=6cm,
xlabel={$V$},
ylabel={$p$},
ylabel near ticks,
xlabel near ticks,
xmajorticks=false,
ymajorticks=false,
]

\node at (30,700) {\small vaste stof};
\node at (100,700) {\small onverzadigde damp};

\coordinate (A) at (40,1200) ;
\coordinate (B) at (80,270) ;
\draw[red, very thick, postaction={decorate,decoration={raise=1.5ex,text along path,text color=red,text align=right,text={Sublimatielijn}}}] (A) to[out=-70,in=160] (B);
\end{axis}

\end{tikzpicture}
\end{center}


\end{document} 

导致

在此处输入图片描述

我觉得这两种方式都有优势,但我不知道最好的继续方式是什么,以便我可以为区域着色,甚至可以计算曲线的交点。

答案1

LaTeX 使我们能够将过去的研究成果数字化,其中一些成果堪称经典。我们可以让它们看起来焕然一新,并将它们呈现给新的受众。我目前正在对 20 世纪 60 年代前苏联研究的大量三元图进行数字化。在实验室中重新创建数据需要数月时间,但使用现代工具,我们只需将图表数字化并使用 PGF 重新绘制它们即可重新创建它们。拥有(估计的)数据是一个真正的好处,因为我们可以用它来指导未来的实验。这不仅仅是重新创建图表。

我使用这个问题作为如何拍摄和处理图像的一个例子。如上所述,它与@arne-timperman的出色答案不同,首先重新创建了图表所基于的数据集。有许多工具可用于执行此操作。我使用DataThief。通过描绘轴并跟踪图形中的项目,Datathief将估计项目的坐标,无论它们是直线,曲线,标签还是其他什么。

生成数据后,接下来就是绘制数据了。在这个特定情况下,有几种生成区域填充的方法。在这里,我只是依靠绘制区域图,以与原始图表一致的方式进行填充。我使用小型 Windows 应用程序 Colorpic 从发布的图像中提取 RBG 值。

代码并不漂亮(见下文),但结果却是漂亮的。

图形

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[left=1.00cm, right=1.00cm, top=1.00cm, bottom=1.00cm]{geometry}
\usepackage{pgfplots}
\usepackage{textcomp}

\pgfplotsset{compat=1.13}
\pgfplotsset{
    every axis plot/.append style={line width=2pt},
}

\definecolor{color-I}{RGB}{173,174,169} 
\definecolor{color-II}{RGB}{132,154,116} 
\definecolor{color-III}{RGB}{77,103,61} 
\definecolor{color-IV}{RGB}{49,71,49} 

\begin{document}
    \begin{tikzpicture}
    \begin{axis}[
    width=15cm,
    height=15cm,
    smooth,
    xmin=0,
    ymin=0,
    xmax=105,
    ymax=100,
    xlabel=V,
    ylabel=p,
    every axis y label/.style={
        font=\Large,
        at={(ticklabel* cs:0.98)},
        anchor=east},
    every axis x label/.style={
        font=\Large,
        at={(ticklabel* cs:1.02)},
        anchor=west},
    xticklabels={,,},
    yticklabels={,,},
    no markers,
    enlarge x limits=false,
    axis background/.style={fill=color-I} %Area I
    ]
    \addplot+ [%Area III
    smooth,
    stack plots=false,
    area style,
    name path=A,
    opacity=1,
    fill=color-III,
    draw=none
    ]
    table
        {x  y
        0   100
        16  100
        16.4141674  98.6295568
        17.7041193  86.2986554
        19.8881234  75.4051159
        21.9639047  66.7802303
        25.8226881  60.3826689
        28.45   58.38
    } \closedcycle;
    \addplot+ [%Area II
    smooth,
    stack plots=false,
    area style,
    name path=B,
    opacity=1,
    fill=color-II,
    draw=none
    ]
    table
        {x  y
        28.45   58.38
        39.1605592  56.6917563
        47.9518358  52.128936
        56.4845711  46.7623768
        65.6426121  40.7346414
        74.8057558  35.3543056
        85.8575736  29.60894
        100 23.9592967
    } \closedcycle;
    \addplot+ [%Area I
    smooth,
    stack plots=false,
    area style,
    name path=C,
    fill=color-IV,
    opacity=1,
    draw=none
    ]
    table
        {x  y
        0   0
        2.8624523   11.1879513
        4.9460913   19.5600611
        7.2716887   26.6318611
        9.0929594   33.7146824
        12.8131089  41.7272732
        15.7601856  47.6523472
        19.2077621  53.0808502
        22.6464092  57.3764038
        27.9596988  59.5265788
        32.8615773  57.4769222
        36.870679   54.1517537
        41.3688002  48.8733648
        45.8592676  42.6238768
        49.5881425  35.7435209
        53.1985894  29.8370199
        57.5655264  23.9139869
        62.4342389  17.6562327
        67.9371867  11.8702516
        73.0784725  8.1965854
        78.6018301  5.0002028
        85.4000364  3.556616
        91.0660587  2.4615268
        94.9720398  2.0524119
        100 0
        } \closedcycle;
    \addplot+ [%40 C
    smooth,
    name path=D,
    opacity=1,
    draw=red,
    solid
    ]
    table
    {x  y
        27.1285597  98.0716543
        32.1169758  91.0018953
        37.1079432  84.2558361
        43.1050129  77.1640345
        48.6028582  70.7306538
        54.606306   64.4481017
        60.8708464  59.2929884
        69.0227853  53.6109954
        77.4281632  48.0853416
        85.5890314  43.536298
        92.3706547  39.9886623
        99.6578803  36.5918553
    } ;
    \addplot+ [%35 C
    smooth,
    name path=D,
    opacity=1,
    draw=red,
    solid
    ]
    table
    {x  y
        21.1886886  96.4208057
        24.2641939  86.6409281
        27.3652116  80.0980488
        34.8561273  70.5454347
        41.9943103  64.2380847
        48.8854323  58.5836449
        55.7829323  53.7384547
        63.6878103  48.709372
        72.2230967  43.6665127
        81.3862404  38.2861769
        88.4174758  34.4093308
        99.474396   29.3113649
    } ;
    \addplot+ [%31 C
    smooth,
    name path=D,
    opacity=1,
    draw=red,
    solid
    ]
    table
    {x  y
        16.4141674  98.6295568
        17.7041193  86.2986554
        19.8881234  75.4051159
        21.9639047  66.7802303
        25.8226881  60.3826689
        39.1605592  56.6917563
        47.9518358  52.128936
        56.4845711  46.7623768
        65.6426121  40.7346414
        74.8057558  35.3543056
        85.8575736  29.60894
        99.9366275  23.9592967
    } ;
    \addplot+ [%20 C
    smooth,
    name path=D,
    opacity=1,
    draw=red,
    solid
    ]
    table
    {x  y
        6.2028262   99.0145882
        6.584694    83.4659759
        7.8720947   70.8113747
        8.5609773   62.2167977
        9.5923877   49.0821575
        10.9155056  40.9593536
        18.0868545  38.8601011
        30.6988501  39.0701182
        40.5396 39.6644523
        47.0945722  39.3593254
        54.7562161  35.4687027
        61.2882273  32.2502775
        67.9475957  29.1909469
        74.8578519  25.9642558
        83.9165993  23.3381237
        91.7183567  21.2250946
        99.6487469  19.43301
    } ;
    \addplot+ [%10 C
    smooth,
    name path=D,
    opacity=1,
    draw=red,
    solid
    ]
    table
    {x  y
        3.4377542   84.1822587
        2.9612869   71.728082
        3.2247267   57.1533245
        2.8590337   42.7541935
        2.8779637   29.1560461
        3.5221999   14.8967225
        13.2228362  13.7134629
        21.7951155  13.3642508
        33.2762028  14.0846156
        49.6732004  14.5356727
        61.2727158  14.2821827
        65.5620444  14.5122014
        71.467474   11.7931026
        79.6500276  9.9955072
        87.0760911  8.214444
        93.3737975  7.2674281
        99.6727794  6.4822622
    } ;
    \node[circle,fill=white,opacity=0.5] at (axis cs: 102, 36){40\textdegree C};
    \node[circle,fill=white,opacity=0.5] at (axis cs: 102, 29){35\textdegree C};
    \node[circle,fill=white,opacity=0.5] at (axis cs: 102, 24){31\textdegree C};
    \node[circle,fill=white,opacity=0.5] at (axis cs: 102, 19){20\textdegree C};
    \node[circle,fill=white,opacity=0.5] at (axis cs: 102, 7){10\textdegree C};
    \node[circle,fill=white,font=\Huge] at (axis cs: 57, 72){I};
    \node[circle,fill=white,font=\Huge] at (axis cs: 74, 17){II};
    \node[circle,fill=white,font=\Huge] at (axis cs: 14, 71){III};
    \node[circle,fill=white,font=\Huge] at (axis cs: 32, 24){IV};
    \node[pin={[circle,fill=yellow,pin edge={yellow,thick}]above:A}] at (axis cs: 87, 8) {};
    \node[pin={[circle,fill=yellow,pin edge={yellow,thick}]below:B}] at (axis cs: 65, 14){};
    \node[pin={[circle,fill=yellow,pin edge={yellow,thick}]below:D}] at (axis cs: 3.3, 14){};
    \node[pin={[circle,fill=yellow,pin edge={yellow,thick}]right:E}] at (axis cs: 2.7, 62){};
    \node[pin={[circle,fill=yellow,pin edge={yellow,thick}]above:K}] at (axis cs: 28, 58){};
    \end{axis}
    \end{tikzpicture}
\end{document}

答案2

我能做的最好的就是这个......

\documentclass{tufte-book}
\usepackage{tikz}

\usepackage{tkz-euclide}
\usetikzlibrary{calc, shadings, arrows.meta}
\usepackage{tkz-euclide}

\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{decorations.text}

    \usepackage[decimalsymbol=comma,exponent-product = \cdot,per-mode=fraction]{siunitx}
\sisetup{load-configurations = abbreviations}
\DeclareSIUnit\kWh{kWh}
\DeclareSIUnit\grc{^\circ C}
\DeclareSIUnit\deeltjes{deeltjes}
    \DeclareSIUnit\hPa{hPa}

    \newcommand*\circled[1]{\tikz[baseline=(char.base)]{\node[shape=circle,draw,inner sep=2pt,fill=white] (char) {#1};}}



\begin{document}

\begin{center}
\begin{tikzpicture}
\begin{axis}[%
major grid style=gray,
title= Isothermen van Andrews,
axis lines=center,
ymin=0,
ymax=10,
xmin=0, xmax=12,
xtick={0,1,...,12},
ytick={0,1,...,10},
tick label style={font=\small},
width=\linewidth,
%height=8cm,
xlabel={$\theta$ (\si{\grc})},
ylabel={$p$ (\si{\hPa})},
%minor xtick={0,5,...,120},
%minor ytick={0,100,...,1600},
%grid=both,
ylabel near ticks,
xlabel near ticks,
xmajorticks=false,
ymajorticks=false,
]
%%% grenslijn   
\coordinate (G1) at (0,0) ;
\coordinate (K) at (3.5,5) ;
\coordinate (B) at (8,0.5) ;
\coordinate (G2) at (11.9,0) ;
\filldraw[fill=red!30, dashed, thick] (G1) to[out=50,in=-170] (K) to[out=-10,in=160] (B) to[out=-10,in=175] (G2);

%%% kritische isotherm
\coordinate (K1) at (1.3,10) ;
\coordinate (K2) at (12.1,2.3) ;
\filldraw[fill=green!30, thick] (K1) to[out=-80,in=160] (K) to[out=-2,in=170] (K2) node[left,yshift=0.3cm] {{\scriptsize $\theta_{\text{kr}}$}} -- (12.1,10);

%%% isotherm
\draw[thick] (2.7,10) to[out=-70,in=170] (12,3.5) node[left,yshift=0.3cm] {{\scriptsize $\SI{34}{\grc}$}};

\draw[thick] (0.8,9.6) -- (1.05,2) -- (6.27,2) to[out=-30,in=175] (12,1) node[left,yshift=0.3cm] {{\scriptsize $\SI{18}{\grc}$}};



%%% gebieden
\coordinate (R) at (8,8) ;
\coordinate (S) at (9,2) ;
\coordinate (T) at (1.3,6) ;
\coordinate (U) at (3.5,3) ;


\node at (R) {\circled{$1$}};
\node at (S) {\circled{$2$}};
\node at (T) {\circled{$3$}};
\node at (U) {\circled{$4$}};
\end{axis}

\tkzDrawPoints[size=10pt](K);
\tkzLabelPoints[above](K);

\end{tikzpicture}
\end{center}


\end{document} 

在此处输入图片描述

第 2 区和第 3 区尚未着色...

相关内容