0

First attempt to create this plot

enter image description here

The minimum working example:

\RequirePackage{filecontents}

\begin{filecontents}{CO2.dat}
O2, CO
0, 72
40, 48
46, 39
52, 28
51.5, 22
49.5, 18
40.5, 16
33, 15
26, 15
19, 14.5
8, 14
0, 12.7
\end{filecontents}

\begin{filecontents}{N2.dat}
O2, CO
0, 72
50, 45
62, 29
65, 25
68, 17
67, 14
66, 13
46, 13
28, 12.8
0, 12.7
\end{filecontents}
\documentclass[crop,tikz]{standalone}
\usepackage{pgfplots,pgfplotstable}

\begin{document}

\pgfplotstableread[col sep = comma]{N2.dat}\Nitrogen 
\pgfplotstableread[col sep = comma]{CO2.dat}\Carbondioxide 

\begin{tikzpicture}
\pgfplotsset{compat=newest}
\pgfplotsset{width=10cm, height=10cm},

\begin{axis}[grid=major,
      xmin=0,xmax=100,
      ymin=0, ymax=80,
ylabel={Carbon Monoxide (mol\%)},
xlabel={Oxygen (mol\%)},
]
\addplot+[] table [x=O2, y=CO, col sep=comma] {\Nitrogen}; \addlegendentry{Nitrogen};
\addplot+[] table [x=O2, y=CO, col sep=comma] {\Carbondioxide}; \addlegendentry{Carbone dioxide};
\end{axis}
\end{tikzpicture}

\end{document}

Produces this:

enter image description here

How can the curves be drawn as shown in the original figure?

  • 1
    filecontents should be used before \documentclass. – cfr Oct 21 '15 at 23:11
  • 3
    In option of addplot try to add smooth. However, your data doesnit lie on smooth line ... so your diagram is now better looking. – Zarko Oct 21 '15 at 23:14
  • See also – Guho Oct 21 '15 at 23:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.