I am new to latex, and would like to plot a graph where the x-axis has intervals. I have this sample code that is not interval:
\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{pgfplots}
\pgfplotsset{width=10cm,compat=1.9} %Changed 1cm to 10cm so plot is visible RMS
%\usepgfplotslibrary{external}
%\tikzexternalize
\begin{document}
Plotting from data:
\begin{tikzpicture}
\begin{axis}[
title={Temperature dependence of CuSO$_4\cdot$5H$_2$O solubility},
xlabel={Temperature [\textcelsius]},
ylabel={Solubility [g per 100 g water]},
xmin=0, xmax=100,
ymin=0, ymax=120,
xtick={0,20,40,60,80,100},
ytick={0,20,40,60,80,100,120},
legend pos=north west,
ymajorgrids=true,
grid style=dashed,
]
\addplot[
color=blue,
mark=square,
]
coordinates {
(0,23.1)(10,27.5)(20,32)(30,37.8)(40,44.6)(60,61.8)(80,83.8)(100,114)
};
\addplot[
color=red,
mark=square,
]
coordinates{
(0,40)(20,60)
};
\legend{CuSO$_4\cdot$5H$_2$O, random, yo}
\end{axis}
\end{tikzpicture}
\end{document}
Additionally, let's say that I have two figure similar and would like to combine them together horizontally, how could I do this and add a text box right under?
Thank you!
x tick label as interval,
and to plot two plots side by side, you may usesubfigure
fromsubcaption
package or use two\addplot
commands inside the sameaxis
environment. adjust the wodth by thewidth
key.