子图和子标题垂直对齐

子图和子标题垂直对齐

我想要实现的是:1) 并排图表按轴垂直对齐;2) 子标题垂直对齐。结果如图所示。我知道是分隔符导致垂直错位,但不确定如何处理它们。子标题在使用和\biggl\Bigl使用时看起来是对齐的。

这里的第二个问题是:有没有办法让并排的图表沿着 x 轴垂直对齐,而无需强制ymin并且ymax相等?

\documentclass{article}
\usepackage{amsmath,amsthm,amssymb,wasysym,mathtools}
\usepackage{caption}
%\usepackage[position=b]{subcaption}
\usepackage{subcaption}
\usepackage%
    [
    %margin=1in,
    right=0.5in,
    left=1in,
    top=0.5in]%
    {geometry}
\usepackage{pgfplots}
\usetikzlibrary{arrows, decorations.markings}
\pgfplotsset{compat = newest}
\begin{document}
        \begin{figure}[htp]
        %\begin{figure}[h!]
            \centering
            \hspace*{\fill}%
            \begin{subfigure}[t]{0.25\linewidth}
                \begin{tikzpicture}
                    \begin{axis}[
                        xmin = -3.5,
                        xmax =  3.5,
                        ymin = -3.0,
                        ymax =  3.0,
                        x = 0.5cm,
                        y = 0.65cm,
                        %
                        every tick label/.append style={font=\tiny},
                        %
                        axis lines = center,
                        axis line style = {-stealth'},
                        %
                        x label style = {yshift = -1em},
                        xlabel = {$x$},
                        %
                        y label style = {xshift = -1.25em, yshift = 0.25em},
                        ylabel = {$y$},
                        %
                        xtick = { 1/2 },
                        xticklabels = { $\frac{1}{2}$ },
                        x tick label style = {xshift=1.25ex},
                        %
                        extra x ticks = { -1/2 },
                        extra x tick labels = {$-\frac{1}{2}$},
                        extra x tick style={tick label style={xshift=-2.4ex}},
                        %
                        ymajorticks=false
                        %
                        ]
                        \addplot[
                                mark=none,
                                domain=0.6:3.5,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(2*(\x-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=-3.5:-0.6,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(2*(-\x-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=0:0.4,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(-2*(\x-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=-0.4:0,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(-2*(-\x-0.5))/ln(0.5)};
                        \addplot[color = black, dashed] coordinates
                                {
                                    ( 0.5, 2.3 )
                                    ( 0.5, -3 )
                                };
                        \addplot[color = black, dashed] coordinates
                                {
                                    ( -0.5, 2.3 )
                                    ( -0.5, -3 )
                                };
                        %
                    \end{axis}
                \end{tikzpicture}%
                \caption{%
                        $
                            y
                            =
                            \log_{ \frac{1}{2} }
                                \bigl\lvert
                                    2 \lvert x \rvert -1
                                \bigr\rvert
                        $
                }
            \begin{minipage}{.1cm}
            \vfill
            \end{minipage}
            \end{subfigure}%
            \hfill%
            \begin{subfigure}[t]{0.25\linewidth}
                \begin{tikzpicture}
                    \begin{axis}[
                        xmin = -2.5,
                        xmax =  4.5,
                        ymin = -3.0,
                        ymax =  3.0,
                        x = 0.5cm,
                        y = 0.65cm,
                        %
                        every tick label/.append style={font=\tiny},
                        %
                        axis lines = center,
                        axis line style = {-stealth'},
                        %
                        x label style = {yshift = -1em},
                        xlabel = {$x$},
                        %
                        y label style = {xshift = -1.25em, yshift = 0.25em},
                        ylabel = {$y$},
                        %
                        xtick = { 3/2 },
                        xticklabels = { $\frac{3}{2}$ },
                        x tick label style = {xshift=1.25ex},
                        %
                        extra x ticks = { 1/2 },
                        extra x tick labels = {$\frac{1}{2}$},
                        %extra x tick label style = {xshift=-5ex},
                        extra x tick style={tick label style={xshift=-2.4ex}},
                        %
                        ymajorticks=false
                        %
                        ]
                        \addplot[
                                mark=none,
                                domain=1.6:4.5,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(2*((\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=-2.5:0.4,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(2*(-(\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=1:1.4,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(-2*((\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=0.6:1,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(-2*(-(\x-1)-0.5))/ln(0.5)};
                        \addplot[color = black, dashed] coordinates
                                {
                                    ( 0.5, 2.3 )
                                    ( 0.5, -3 )
                                };
                        \addplot[color = black, dashed] coordinates
                                {
                                    ( 1.5, 2.3 )
                                    ( 1.5, -3 )
                                };
                        %
                    \end{axis}
                \end{tikzpicture}%
                \caption{
                        $
                            y
                            =
                            \log_{ \frac{1}{2} }
                                \bigl\lvert
                                    2 \lvert x - 1 \rvert -1
                                \bigr\rvert
                        $
                }
            \begin{minipage}{.1cm}
            \vfill
            \end{minipage}
            \end{subfigure}%
            \hfill%
            \begin{subfigure}[t]{0.25\linewidth}
                \begin{tikzpicture}
                    \begin{axis}[
                        xmin = -4.2,
                        xmax =  4.2,
                        ymin = -3.0,
                        ymax =  3.0,
                        x = 0.5cm,
                        y = 0.65cm,
                        %
                        %
                        every tick label/.append style={font=\tiny},
                        %
                        axis lines = center,
                        axis line style = {-stealth'},
                        %
                        x label style = {yshift = -1em},
                        xlabel = {$x$},
                        %
                        y label style = {xshift = -1.25em, yshift = 0.25em},
                        ylabel = {$y$},
                        %
                        xtick = { 1/2,3/2 },
                        xticklabels = { $\frac{1}{2}$,$\frac{3}{2}$ },
                        x tick label style = {xshift=1.25ex},
                        %
                        extra x ticks = { -3/2, -1/2, 1/2 },
                        extra x tick labels =
                        {$-\frac{3}{2}$,$-\frac{1}{2}$},
                        %extra x tick label style = {xshift=-5ex},
                        extra x tick style={tick label style={xshift=-2.4ex}},
                        %
                        ymajorticks=false
                        %
                        ]
                        \addplot[
                                mark=none,
                                domain=0:0.4,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(2*(-(\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=-0.4:0,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(2*(-(-\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=1.6:4.2,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(2*((\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=-4.2:-1.6,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(2*((-\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=1:1.4,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(-2*((\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=-1.4:-1,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(-2*((-\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=0.6:1,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(-2*(-(\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=-1:-0.6,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(-2*(-(-\x-1)-0.5))/ln(0.5)};
                        \addplot[color = black, dashed] coordinates
                                {
                                    ( 0.5, 2.3 )
                                    ( 0.5, -3 )
                                };
                        \addplot[color = black, dashed] coordinates
                                {
                                    ( -0.5, 2.3 )
                                    ( -0.5, -3 )
                                };
                        \addplot[color = black, dashed] coordinates
                                {
                                    ( 1.5, 2.3 )
                                    ( 1.5, -3 )
                                };
                        \addplot[color = black, dashed] coordinates
                                {
                                    ( -1.5, 2.3 )
                                    ( -1.5, -3 )
                                };
                        %
                    \end{axis}
                \end{tikzpicture}%
                \caption{
                        $
                            y
                            =
                            \log_{ \frac{1}{2} }
                                \Bigl\lvert
                                    2 \bigl\lvert \lvert x \rvert - 1 \bigr\rvert -1
                                \Bigr\rvert
                        $
                }
            \begin{minipage}{.1cm}
            \vfill
            \end{minipage}
            \end{subfigure}%
            \hfill%
            \begin{subfigure}[t]{0.25\linewidth}
                \begin{tikzpicture}
                    \begin{axis}[
                        xmin = -4.2,
                        xmax =  4.2,
                        ymin = -3.0,
                        ymax =  3.0,
                        x = 0.5cm,
                        y = 0.65cm,
                        %
                        every tick label/.append style={font=\tiny},
                        %
                        axis lines = center,
                        axis line style = {-stealth'},
                        %
                        x label style = {yshift = -1em},
                        xlabel = {$x$},
                        %
                        y label style = {xshift = -1.25em, yshift = 0.25em},
                        ylabel = {$y$},
                        %
                        xtick = { 1/2,3/2 },
                        xticklabels = { $\frac{1}{2}$,$\frac{3}{2}$ },
                        x tick label style = {xshift=1.25ex},
                        %
                        extra x ticks = { -3/2, -1/2 },
                        extra x tick labels =
                        {$-\frac{3}{2}$,$-\frac{1}{2}$},
                        extra x tick style={tick label style={xshift=-2.4ex}},
                        %
                        ymajorticks=false
                        %
                        ]
                        \addplot[
                                mark=none,
                                domain=0:0.4,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(2*(-(\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=-0.4:0,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(2*(-(-\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=1.6:2,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(2*((\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=2:4.2,
                                draw=red,
                                samples=200,
                                thick
                                ] {-ln(2*((\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=-4.2:-2,
                                draw=red,
                                samples=200,
                                thick
                                ] {-ln(2*((-\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=-2:-1.6,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(2*((-\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=1:1.4,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(-2*((\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=-1.4:-1,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(-2*((-\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=0.6:1,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(-2*(-(\x-1)-0.5))/ln(0.5)};
                        \addplot[
                                mark=none,
                                domain=-1:-0.6,
                                draw=red,
                                samples=200,
                                thick
                                ] {ln(-2*(-(-\x-1)-0.5))/ln(0.5)};
                        \addplot[color = black, dashed] coordinates
                                {
                                    ( 0.5, 2.3 )
                                    ( 0.5, -3 )
                                };
                        \addplot[color = black, dashed] coordinates
                                {
                                    ( -0.5, 2.3 )
                                    ( -0.5, -3 )
                                };
                        \addplot[color = black, dashed] coordinates
                                {
                                    ( 1.5, 2.3 )
                                    ( 1.5, -3 )
                                };
                        \addplot[color = black, dashed] coordinates
                                {
                                    ( -1.5, 2.3 )
                                    ( -1.5, -3 )
                                };
                        %
                    \end{axis}
                \end{tikzpicture}%
                \caption{%
                        $
                            y
                            =
                            \biggl\lvert
                            \log_{ \frac{1}{2} }
                                \Bigl\lvert
                                    2 \bigl\lvert \lvert x \rvert - 1 \bigr\rvert -1
                                \Bigr\rvert
                            \biggr\rvert
                        $%
                }
            \end{subfigure}%
            \hspace*{\fill}%
        \end{figure}
\end{document}

在此处输入图片描述

答案1

  • 可以通过插入前两个标题来解决标题的垂直对齐问题\vphantom{\Bigl\lvert}(参见最小工作示例:MWE)。这样,所有标题将具有相同的高度。
  • 您的图形代码可以通过以下方式大大缩短:
    • 在所有图表的开头定义通用图表样式,
    • 添加restrict y to domain=-2.4:2.4,通用图表样式,
    • abs通过在公式中使用来重新制定函数。
  • 除了前面提到的 MWE 中的缩小subfigure尺寸、删除minipage(它们只是杂乱的)
\documentclass{article}
\usepackage[hmargin={1in,0.5in},
            top=0.5in]{geometry}
\usepackage{amsthm,amssymb,mathtools}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{pgfplots}
\usetikzlibrary{arrows.meta, 
                decorations.markings}
\pgfplotsset{compat = 1.18}

\begin{document}
    \begin{figure}[ht]
\pgfplotsset{
        axis lines = center,
        axis line style = {-Stealth},
        xmin = -3.5,    xmax =  3.5,
        ymin = -2.4,    ymax =  3,
    restrict y to domain=-2.4:2.4,        % <=======
        x = 0.6cm,
        y = 0.6cm,
%
        label style = {anchor=north east},
        xlabel = {$x$},
        ylabel = {$y$},
%
        every tick label/.append style={font=\tiny},
%
        ytick=\empty,
%
        no marks,   samples=500,
        every axis plot post/.append style={red, thick}
             }

\begin{subfigure}[t]{0.24\linewidth}
    \begin{tikzpicture}
\begin{axis}[
    xtick = {-0.5},
    xticklabels = { $-\frac{1}{2}$ },
    x tick label style = {xshift=-1.5ex},
%
    extra x ticks = {0.5},
    extra x tick labels = {$\frac{1}{2}$},
    extra x tick style = {xshift=+3ex},
            ]
\addplot[domain=-3.5:3.5] {ln(2*(abs(\x)-0.5))/ln(0.5)};
\addplot[domain=-0.5:0.5] {ln(-2*(abs(\x)-0.5))/ln(0.5)};
%
\draw[dashed]  (-0.5,-2.4) -- (-0.5,2.4)
               ( 0.5,-2.4) -- ( 0.5,2.4);
\end{axis}
    \end{tikzpicture}
\caption{$\vphantom{\Bigl\lvert}
         y = \log_{\frac{1}{2}} \bigl\lvert 2\lvert x \rvert -1 \bigr\rvert$}
\end{subfigure}%
\hfill% 2
\begin{subfigure}[t]{0.24\linewidth}
    \begin{tikzpicture}
\begin{axis}[
    xmin=-2.5,  xmax=4.5,
xtick = {0.5},
    xticklabels = {$\frac{1}{2}$},
    x tick label style = {xshift=-1ex},
%
    extra x ticks = {1.5},
    extra x tick labels = {$\frac{3}{2}$},
    extra x tick style={tick label style={xshift=2ex}},
            ]
\addplot[domain=-2.5:4.5] {ln(+2*(abs(\x-1)-0.5))/ln(0.5)}; 
\addplot[domain= 0.5:1.5] {ln(-2*(abs(\x-1)-0.5))/ln(0.5)};
%
\draw[dashed]  (0.5,-2.4) -- (0.5,2.4)
               (1.5,-2.4) -- (1.5,2.4);
\end{axis}
    \end{tikzpicture}%
\caption{$\vphantom{\Bigl\lvert}
         y = \log_{\frac{1}{2}} \bigl\lvert 2 \lvert x - 1 \rvert -1\bigr\rvert $}
\end{subfigure}%
\hfill% 3
\begin{subfigure}[t]{0.24\linewidth}
    \begin{tikzpicture}
\begin{axis}[
    xtick = {-1.5,-0.5},
    xticklabels = {$-\frac{3}{2}$, $-\frac{1}{2}$},
    x tick label style = {xshift=-1.5ex},
%
    extra x ticks = {0.5, 1.5},
    extra x tick labels = {$\frac{1}{2}$, $\frac{3}{2}$},
    extra x tick style = {xshift=+3ex},
            ]
\addplot[domain=-4.5:4.5] {ln(2*((abs(\x)-1)-0.5))/ln(0.5)};
\addplot[domain=-0.5:0.5] {ln(2*(-(abs(\x)-1)-0.5))/ln(0.5)}; 
\addplot[domain=-1:1] {ln(2*(+(abs(\x)-1)+0.5))/ln(0.5)};
%
\addplot[domain=-1.5:-1] {ln(2*(-(-\x-0.5)+1))/ln(0.5)}; 
\addplot[domain= 1 :1.5] {ln(2*(-(+\x-0.5)+1))/ln(0.5)}; 
%
\draw[dashed]  (-1.5,-2.4) -- (-1.5,2.4)
               (-0.5,-2.4) -- (-0.5,2.4)
               ( 0.5,-2.4) -- ( 0.5,2.4)
               ( 1.5,-2.4) -- ( 1.5,2.4);
\end{axis}
    \end{tikzpicture}
\caption{$y = \log_{\frac{1}{2}}\Bigl\lvert 
                2 \bigl\lvert\lvert x \rvert - 1 \bigr\rvert -1\Bigr\rvert$}

\end{subfigure}%
\hfill% 4
\begin{subfigure}[t]{0.24\linewidth}
    \begin{tikzpicture}
\begin{axis}[
    xtick = {-1.5,-0.5},
    xticklabels = {$-\frac{3}{2}$, $-\frac{1}{2}$},
    x tick label style = {xshift=-1.5ex},
%
    extra x ticks = {0.5, 1.5},
    extra x tick labels = {$\frac{1}{2}$, $\frac{3}{2}$},
    extra x tick style = {xshift=+3ex},
            ]
\addplot[domain=-4.5:4.5] {-abs(ln(2*((abs(\x)-1)-0.5)))/ln(0.5)};
%
\addplot[domain=-0.5:0.5] {ln(2*(-(abs(\x)-1)-0.5))/ln(0.5)};
\addplot[domain=-1:1] {ln(2*(+(abs(\x)-1)+0.5))/ln(0.5)};
%
\addplot[domain=-1.5:-1] {ln(2*(-(-\x-0.5)+1))/ln(0.5)};
\addplot[domain= 1 :1.5] {ln(2*(-(+\x-0.5)+1))/ln(0.5)};
%
\draw[dashed]  (-1.5,-2.4) -- (-1.5,2.4)
               (-0.5,-2.4) -- (-0.5,2.4)
               ( 0.5,-2.4) -- ( 0.5,2.4)
               ( 1.5,-2.4) -- ( 1.5,2.4);
\end{axis}
    \end{tikzpicture}
\caption{$y = \log_{\frac{1}{2}}\Bigl\lvert
                2 \bigl\lvert\lvert x \rvert - 1 \bigr\rvert -1\Bigr\rvert$}

\end{subfigure}%
\caption{Common caption}
    \end{figure}
\end{document}

在此处输入图片描述

答案2

对于第一个问题:只需在本地更改控制浮点数与标题之间的距离的参数,即skip

\documentclass{article}
\usepackage{amsmath,amsthm,amssymb,wasysym,mathtools}
\usepackage{caption}
%\usepackage[position=b]{subcaption}
\usepackage{subcaption}
\usepackage%
[
%margin=1in,
right=0.5in,
left=1in,
top=0.5in]%
{geometry}
\usepackage{pgfplots}
\usetikzlibrary{arrows, decorations.markings}
\pgfplotsset{compat = newest}
\begin{document}
    \begin{figure}[htp]
        %\begin{figure}[h!]
        \centering
        \hspace*{\fill}%
        \begin{subfigure}[t]{0.25\linewidth}
            \begin{tikzpicture}
                \begin{axis}[
                    xmin = -3.5,
                    xmax =  3.5,
                    ymin = -3.0,
                    ymax =  3.0,
                    x = 0.5cm,
                    y = 0.65cm,
                    %
                    every tick label/.append style={font=\tiny},
                    %
                    axis lines = center,
                    axis line style = {-stealth'},
                    %
                    x label style = {yshift = -1em},
                    xlabel = {$x$},
                    %
                    y label style = {xshift = -1.25em, yshift = 0.25em},
                    ylabel = {$y$},
                    %
                    xtick = { 1/2 },
                    xticklabels = { $\frac{1}{2}$ },
                    x tick label style = {xshift=1.25ex},
                    %
                    extra x ticks = { -1/2 },
                    extra x tick labels = {$-\frac{1}{2}$},
                    extra x tick style={tick label style={xshift=-2.4ex}},
                    %
                    ymajorticks=false
                    %
                    ]
                    \addplot[
                    mark=none,
                    domain=0.6:3.5,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(2*(\x-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=-3.5:-0.6,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(2*(-\x-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=0:0.4,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(-2*(\x-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=-0.4:0,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(-2*(-\x-0.5))/ln(0.5)};
                    \addplot[color = black, dashed] coordinates
                    {
                        ( 0.5, 2.3 )
                        ( 0.5, -3 )
                    };
                    \addplot[color = black, dashed] coordinates
                    {
                        ( -0.5, 2.3 )
                        ( -0.5, -3 )
                    };
                    %
                \end{axis}
            \end{tikzpicture}{\captionsetup{skip=9pt}%%<-- change the caption's skip locally
            \caption{%
                $
                y
                =
                \log_{ \frac{1}{2} }
                \bigl\lvert
                2 \lvert x \rvert -1
                \bigr\rvert
                $
            }}
            \begin{minipage}{.1cm}
                \vfill
            \end{minipage}
        \end{subfigure}%
        \hfill%
        \begin{subfigure}[t]{0.25\linewidth}
            \begin{tikzpicture}
                \begin{axis}[
                    xmin = -2.5,
                    xmax =  4.5,
                    ymin = -3.0,
                    ymax =  3.0,
                    x = 0.5cm,
                    y = 0.65cm,
                    %
                    every tick label/.append style={font=\tiny},
                    %
                    axis lines = center,
                    axis line style = {-stealth'},
                    %
                    x label style = {yshift = -1em},
                    xlabel = {$x$},
                    %
                    y label style = {xshift = -1.25em, yshift = 0.25em},
                    ylabel = {$y$},
                    %
                    xtick = { 3/2 },
                    xticklabels = { $\frac{3}{2}$ },
                    x tick label style = {xshift=1.25ex},
                    %
                    extra x ticks = { 1/2 },
                    extra x tick labels = {$\frac{1}{2}$},
                    %extra x tick label style = {xshift=-5ex},
                    extra x tick style={tick label style={xshift=-2.4ex}},
                    %
                    ymajorticks=false
                    %
                    ]
                    \addplot[
                    mark=none,
                    domain=1.6:4.5,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(2*((\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=-2.5:0.4,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(2*(-(\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=1:1.4,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(-2*((\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=0.6:1,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(-2*(-(\x-1)-0.5))/ln(0.5)};
                    \addplot[color = black, dashed] coordinates
                    {
                        ( 0.5, 2.3 )
                        ( 0.5, -3 )
                    };
                    \addplot[color = black, dashed] coordinates
                    {
                        ( 1.5, 2.3 )
                        ( 1.5, -3 )
                    };
                    %
                \end{axis}
            \end{tikzpicture}{\captionsetup{skip=9pt}%%<-- change the caption's skip locally
            \caption{
                $
                y
                =
                \log_{ \frac{1}{2} }
                \bigl\lvert
                2 \lvert x - 1 \rvert -1
                \bigr\rvert
                $
            }}
            \begin{minipage}{.1cm}
                \vfill
            \end{minipage}
        \end{subfigure}%
        \hfill%
        \begin{subfigure}[t]{0.25\linewidth}
            \begin{tikzpicture}
                \begin{axis}[
                    xmin = -4.2,
                    xmax =  4.2,
                    ymin = -3.0,
                    ymax =  3.0,
                    x = 0.5cm,
                    y = 0.65cm,
                    %
                    %
                    every tick label/.append style={font=\tiny},
                    %
                    axis lines = center,
                    axis line style = {-stealth'},
                    %
                    x label style = {yshift = -1em},
                    xlabel = {$x$},
                    %
                    y label style = {xshift = -1.25em, yshift = 0.25em},
                    ylabel = {$y$},
                    %
                    xtick = { 1/2,3/2 },
                    xticklabels = { $\frac{1}{2}$,$\frac{3}{2}$ },
                    x tick label style = {xshift=1.25ex},
                    %
                    extra x ticks = { -3/2, -1/2, 1/2 },
                    extra x tick labels =
                    {$-\frac{3}{2}$,$-\frac{1}{2}$},
                    %extra x tick label style = {xshift=-5ex},
                    extra x tick style={tick label style={xshift=-2.4ex}},
                    %
                    ymajorticks=false
                    %
                    ]
                    \addplot[
                    mark=none,
                    domain=0:0.4,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(2*(-(\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=-0.4:0,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(2*(-(-\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=1.6:4.2,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(2*((\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=-4.2:-1.6,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(2*((-\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=1:1.4,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(-2*((\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=-1.4:-1,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(-2*((-\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=0.6:1,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(-2*(-(\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=-1:-0.6,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(-2*(-(-\x-1)-0.5))/ln(0.5)};
                    \addplot[color = black, dashed] coordinates
                    {
                        ( 0.5, 2.3 )
                        ( 0.5, -3 )
                    };
                    \addplot[color = black, dashed] coordinates
                    {
                        ( -0.5, 2.3 )
                        ( -0.5, -3 )
                    };
                    \addplot[color = black, dashed] coordinates
                    {
                        ( 1.5, 2.3 )
                        ( 1.5, -3 )
                    };
                    \addplot[color = black, dashed] coordinates
                    {
                        ( -1.5, 2.3 )
                        ( -1.5, -3 )
                    };
                    %
                \end{axis}
            \end{tikzpicture}%
            \caption{
                $
                y
                =
                \log_{ \frac{1}{2} }
                \Bigl\lvert
                2 \bigl\lvert \lvert x \rvert - 1 \bigr\rvert -1
                \Bigr\rvert
                $
            }
            \begin{minipage}{.1cm}
                \vfill
            \end{minipage}
        \end{subfigure}%
        \hfill%
        \begin{subfigure}[t]{0.25\linewidth}
            \begin{tikzpicture}
                \begin{axis}[
                    xmin = -4.2,
                    xmax =  4.2,
                    ymin = -3.0,
                    ymax =  3.0,
                    x = 0.5cm,
                    y = 0.65cm,
                    %
                    every tick label/.append style={font=\tiny},
                    %
                    axis lines = center,
                    axis line style = {-stealth'},
                    %
                    x label style = {yshift = -1em},
                    xlabel = {$x$},
                    %
                    y label style = {xshift = -1.25em, yshift = 0.25em},
                    ylabel = {$y$},
                    %
                    xtick = { 1/2,3/2 },
                    xticklabels = { $\frac{1}{2}$,$\frac{3}{2}$ },
                    x tick label style = {xshift=1.25ex},
                    %
                    extra x ticks = { -3/2, -1/2 },
                    extra x tick labels =
                    {$-\frac{3}{2}$,$-\frac{1}{2}$},
                    extra x tick style={tick label style={xshift=-2.4ex}},
                    %
                    ymajorticks=false
                    %
                    ]
                    \addplot[
                    mark=none,
                    domain=0:0.4,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(2*(-(\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=-0.4:0,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(2*(-(-\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=1.6:2,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(2*((\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=2:4.2,
                    draw=red,
                    samples=200,
                    thick
                    ] {-ln(2*((\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=-4.2:-2,
                    draw=red,
                    samples=200,
                    thick
                    ] {-ln(2*((-\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=-2:-1.6,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(2*((-\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=1:1.4,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(-2*((\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=-1.4:-1,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(-2*((-\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=0.6:1,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(-2*(-(\x-1)-0.5))/ln(0.5)};
                    \addplot[
                    mark=none,
                    domain=-1:-0.6,
                    draw=red,
                    samples=200,
                    thick
                    ] {ln(-2*(-(-\x-1)-0.5))/ln(0.5)};
                    \addplot[color = black, dashed] coordinates
                    {
                        ( 0.5, 2.3 )
                        ( 0.5, -3 )
                    };
                    \addplot[color = black, dashed] coordinates
                    {
                        ( -0.5, 2.3 )
                        ( -0.5, -3 )
                    };
                    \addplot[color = black, dashed] coordinates
                    {
                        ( 1.5, 2.3 )
                        ( 1.5, -3 )
                    };
                    \addplot[color = black, dashed] coordinates
                    {
                        ( -1.5, 2.3 )
                        ( -1.5, -3 )
                    };
                    %
                \end{axis}
            \end{tikzpicture}\captionsetup{skip=3pt}%<-- change the caption's skip
            \caption{%
                $
                y
                =
                \biggl\lvert
                \log_{ \frac{1}{2} }
                \Bigl\lvert
                2 \bigl\lvert \lvert x \rvert - 1 \bigr\rvert -1
                \Bigr\rvert
                \biggr\rvert
                $%
            }
        \end{subfigure}%
        \hspace*{\fill}%
    \end{figure}
\end{document}

相关内容