1

I draw this diagram following a conversation though I could not understand the declare function part and so took the same values to get closer to what I needed. However, I need the following amendments:

  1. Moving the x-axis label from below to right of the axis, and removing the ticks and values -3, -2 etc.
  2. Changing the diagram aspect ratio: reducing the height to almost 0.75 of the current height and increasing the width to 1.5 of the current width.

Here is my code:

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{nccmath, amsmath}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\usepgfplotslibrary{groupplots,fillbetween}
\DeclareMathOperator{\CDF}{cdf}
\DeclareMathOperator{\PDF}{pdf}
\begin{document}
\begin{tikzpicture}[declare function={%
    normcdf(\x,\m,\s)=1/(1 + exp(-0.07056*((\x-\m)/\s)^3 - 1.5976*(\x-\m)/\s));
    gauss(\x,\u,\v)=1/(\v*sqrt(2*pi))*exp(-((\x-\u)^2)/(2*\v^2));
    }]
\begin{groupplot}
[group style={group size=1 by 2},
xmin=-3,xmax=3,ymin=0,
domain=-3:3, xlabel=Time, axis lines=left]

\nextgroupplot[ylabel=Marginal Response, ytick=\empty, ymax=1]
\addplot[smooth, black,thick, xtick=\empty] {gauss(x,0,1)};
\draw [dashed](0,0)--(0,1);
\draw [dashed](3,0)--(3,1);

\nextgroupplot[ylabel=Cumulative Response, ytick=\empty, ymax=1]
\addplot[smooth, black,thick] {normcdf(x,0,1)};
\draw [dashed](0,0)--(0,2);
\draw [dashed](3,0)--(3,2);

\end{groupplot}

\end{tikzpicture} \end{document}

enter image description here

1 Answers1

2

You can set the width and height with the width and height keys. You were already using ytick=\empty to remove the y ticks, another xtick=\empty will remove the x ticks. And you can move the x label via

xlabel style={at={(axis description cs:1,0)},anchor=north east},

To have lines that go across the group plots, you can define symbolic coordinates that you use in the ambient tikzpicture.

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{nccmath, amsmath}
%\usepackage{graphicx}% loaded by tikz
%\usepackage{tikz}% loaded by pgfplots 
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\usepgfplotslibrary{groupplots,fillbetween}
\DeclareMathOperator{\CDF}{cdf}
\DeclareMathOperator{\PDF}{pdf}
\begin{document}
\begin{tikzpicture}[declare function={%
    normcdf(\x,\m,\s)=1/(1 + exp(-0.07056*((\x-\m)/\s)^3 - 1.5976*(\x-\m)/\s));
    gauss(\x,\u,\v)=1/(\v*sqrt(2*pi))*exp(-((\x-\u)^2)/(2*\v^2));
    }]
\begin{groupplot}
[group style={group size=1 by 2},
xmin=-3,xmax=3,ymin=0,width=12cm,height=6cm,
xtick=\empty,ytick=\empty,ymax=1,
xlabel style={at={(axis description cs:1,0)},anchor=north east},
domain=-3:3, xlabel=Time, axis lines=left]

\nextgroupplot[ylabel=Marginal Response]
\addplot[smooth, black,thick, xtick=\empty] {gauss(x,0,1)};
\path (0,\pgfkeysvalueof{/pgfplots/ymax}) coordinate (t1)
 (3,\pgfkeysvalueof{/pgfplots/ymax}) coordinate (t2);

\nextgroupplot[ylabel=Cumulative Response]
\addplot[smooth, black,thick] {normcdf(x,0,1)};
\path (0,\pgfkeysvalueof{/pgfplots/ymin}) coordinate (b1)
 (3,\pgfkeysvalueof{/pgfplots/ymin}) coordinate (b2);

\end{groupplot}
\draw[dashed] (b1) -- (t1);
\draw[dashed] (b2) -- (t2);

\end{tikzpicture} \end{document}

enter image description here