How would I specify intervals?

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,
]

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)
};

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!

• I think you need x tick label as interval, and to plot two plots side by side, you may use subfigure from subcaption package or use two \addplot commands inside the same axis environment. adjust the wodth by the width key. – user11232 Apr 4 '15 at 2:29

Intervals

I cannot post a picture in a comment, so I use the answer function. Do you mean something like this (you have to look closely in order to be able to see the fine tick lines): In the current pgfplots documentation (Revision 1.12) you find on page 286 (Chapter 4.15) the following example (see comment from Harish Kumar):

\begin{tikzpicture}
\begin{axis}[
ybar interval=0.9,
x tick label as interval,
xmin=2003,xmax=2030,
ymin=0,ymax=140,
xticklabel={
$\pgfmathprintnumber{\tick}$
-- $\pgfmathprintnumber{\nexttick}$},
xtick=data,
x tick label style={
rotate=90,anchor=east,
/pgf/number format/1000 sep=}
]
coordinates
{(2003,40) (2005,100) (2006,15)
(2010,90) (2020,120) (2030,3)};
\end{axis}
\end{tikzpicture} Description of x tick label as interval: Allows to treat tick labels as intervals; that means the tick positions denote the interval boundaries. If there are n positions, (n 􀀀 1) tick labels will be generated, one for each interval.

Two plots Side-by-Side

As Harish Kumar mentioned you can have two plots side by side. Look for Vertical Alignment with baseline (Chapter 4.19.2 ff.) and Horizontal Alignment (Chapter 4.19.3 ff.) in the pgfplots documentation (Chapter 4.19. Alignment Options).

Here's an example:

\pgfplotsset{domain=-1:1}
% Diagram 1
\begin{tikzpicture}[baseline]
\begin{axis}[xlabel=A normal sized $x$ label]
\begin{axis}[xlabel={$\displaystyle \sum_{i=0}^N n_i$ }] 