
\documentclass[border=5mm]{standalone}
\usepackage{amsmath}
\usepackage{pgfplotstable} % For \pgfplotstablereadm also loads pgfplots
\usepgfplotslibrary{groupplots}
\pgfplotsset{compat=1.15}
\pgfplotstableread{
55 20
100 21
}\datatablea
\pgfplotstableread{
55 30
100 35
}\datatableb
\pgfplotstableread{
55 50
100 56
}\datatablec
\begin{document}
\begin{tikzpicture}
\begin{groupplot}[
group style={
% set number of axes, columns by rows
group size=3 by 1,
% we don't want any gap between axes
horizontal sep=0pt
},
% the following settings apply to all three axes
ymin=0,ymax=110,
axis lines=middle,
enlarge x limits=0.2,
width=5cm,
height=5cm,
scale only axis,
axis x discontinuity=crunch,
xtick=data,
ytick=data,
longlines/.style={
shorten >=-5mm,
shorten <=-5mm
},
clip=false
]
% \nextgroupplot starts a new axis
\nextgroupplot[
x axis line style={-}, % remove arrow tip
width=2cm, % make this narrower
xmin=19,
ylabel=$P$
]
\addplot +[longlines] table[x index=1,y index=0] {\datatablea}
node [above left, black] {$S_B$}
;
\coordinate (a100) at (\pgfkeysvalueof{/pgfplots/xmin},100);
\coordinate (a55) at (\pgfkeysvalueof{/pgfplots/xmin},55);
% plot vertical dashed lines
\addplot [ycomb,dashed,mark=none] table[x index=1,y index=0] {\datatablea};
\nextgroupplot[
hide y axis, % don't want y-axis here
x axis line style={-}
]
\addplot +[longlines] table[x index=1,y index=0] {\datatableb}
node [above left, black] {$S_A$}
;
\addplot [ycomb,dashed,mark=none] table[x index=1,y index=0] {\datatableb};
\nextgroupplot[
hide y axis,
xlabel={$Q_S$}
]
\addplot +[longlines] table[x index=1,y index=0] {\datatablec}
coordinate [pos=0] (3a)
coordinate [pos=1] (3b)
node [above left, black] {$S_{\text{something}}$}
;
\addplot [ycomb,dashed,mark=none] table[x index=1,y index=0] {\datatablec};
\end{groupplot}
% draw horizontal dashed lines
\draw [dashed] (a100) -- (3b);
\draw [dashed] (a55) -- (3a);
\end{tikzpicture}
\end{document}
crunchsymbol with pgfplots: http://tex.stackexchange.com/questions/79269/how-to-show-the-data-does-not-start-at-zero-symbol-on-a-pgfplot-graph/79272#79272, http://tex.stackexchange.com/questions/84229/discontinuity-of-log-axis-in-pgfplots – Ignasi Nov 11 '16 at 10:57groupplot), as in http://tex.stackexchange.com/questions/46422/axis-break-in-pgfplots – Torbjørn T. Nov 20 '16 at 03:04