pfg 軸の不連続オプション

pfg 軸の不連続オプション

x 軸の不連続の長さを設定する方法はありますか? 私が使用したコードは次のとおりです:

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
  thick,
    black,%Set the color of the main axes and numbers
    scale=0.389,
    axis lines=left,
    xmin=200,
    xmax=350,
    ymin=0,
    ymax=3,
    major tick length=1.5pt,
    minor tick length=1pt,
    tick align = inside,
    axis x discontinuity=crunch,
    legend cell align={left},
    legend style={anchor=north, draw=none},
    label style={font=\tiny},
    tick label style={font=\tiny},
] 
\end{axis}
\end{tikzpicture}
\end{document}

ほぼ 1 つの単位を占める不連続マーカーが付いた図が表示されます。

ここに画像の説明を入力してください

下の図のように、不連続マーカーを短くしたいと思います。

助けてくれてありがとう!

ここに画像の説明を入力してください

答え1

これは可能性のある解決策。より良い解決策があるかどうかは分かりません。

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\makeatletter
\def\pgfplots@drawaxis@lines@preparediscont@for#1{%
        \ifnum\csname pgfplots@#1axisdiscontnum\endcsname>0
                \begingroup
                % this group employs several temporary dimension registers
                % and is therefor scoped:
                \let\disstart=\pgf@ya
                \let\disend=\pgf@yb
                \disend=\csname pgfplots@#1max@reg\endcsname
                \advance\disend by -\csname pgfplots@#1min@reg\endcsname
                \disend=\csname pgfplots@#1@veclength\endcsname\disend
                \ifcase\csname pgfplots@#1axisdiscontnum\endcsname\relax
                        % has already been checked above.
                \or
                        \def\discontstyle{decoration={zigzag,segment length=8pt, amplitude=3pt}}%
                        \advance \disend by -12pt
                \or
                        \def\discontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}%
                        \advance \disend by -8pt
                \fi
                \pgfplotscoordmath{#1}{datascaletrafo get params}%
                % if #1max + shift < 0pt  (shift is 0 without the scaling trafo)
                \ifdim\csname pgfplots@#1max@reg\endcsname<-\pgfplotsretvalb pt
                        % swap start and end
                        \disstart=\disend
                        \disend=4pt
                \else
                        \disstart=4pt
                \fi
                % carry local computations outside of group:
                \xdef\pgfplots@glob@TMPa{%
                        \noexpand\def\expandafter\noexpand\csname #1disstart\endcsname{\the\disstart}%
                        \noexpand\def\expandafter\noexpand\csname #1disend\endcsname{\the\disend}%
                        \noexpand\pgfkeysdef{/tikz/#1discont}{\noexpand\pgfkeysalso{\discontstyle}}%
                }%
                \endgroup
                \pgfplots@glob@TMPa
        \else
                \expandafter\def\csname #1disstart\endcsname{0pt}%
                \expandafter\def\csname #1disend\endcsname{0pt}%
                \pgfkeyslet{/tikz/#1discont}=\pgfutil@empty
        \fi
}%
\makeatother
\begin{document}
\begin{tikzpicture}
\begin{axis}[
  thick,
    black,%Set the color of the main axes and numbers
    scale=0.389,
    axis lines=left,
    xmin=200,
    xmax=350,
    ymin=0,
    ymax=3,
    major tick length=1.5pt,
    minor tick length=1pt,
    tick align = inside,
    axis x discontinuity=crunch,
    legend cell align={left},
    legend style={anchor=north, draw=none},
    label style={font=\tiny},
    tick label style={font=\tiny},
] 
\end{axis}
\end{tikzpicture}
\end{document}

私が変更され

\def\discontstyle{decoration={zigzag,segment length=8pt, amplitude=3pt}}%
\advance \disend by -12pt

もともとはpgfplots.code.tex

\def\discontstyle{decoration={zigzag,segment length=12pt, amplitude=4pt}}%
\advance \disend by -16pt

取得するため

ここに画像の説明を入力してください

関連情報