0

I am struggling to increase the size of the tikzpicture. When I load the code in an article or book class, the diagram is small. I have tried the scale command though the resulting output is very awful. Below is the MWE which is a solution provided to my question at Adding colored vertical dashed lines and removing circles on horizontal lines.

\documentclass{standalone}
\usepackage{pgfplots, pgfplotstable}
\usepackage{amsmath}

\makeatletter \long\def\ifnodedefined#1#2#3{% @ifundefined{pgf@sh@ns@#1}{#3}{#2}% }

\pgfplotsset{ discontinuous/.style={ scatter, scatter/@pre marker code/.code={ \ifnodedefined{marker}{ \pgfpointdiff{\pgfpointanchor{marker}{center}}% {\pgfpoint{0}{0}}% \ifdim\pgf@y>0pt \tikzset{options/.style={mark=none}} \draw [densely dashed,blue,thin] (O-|0,0) -- (0,0); %\draw plot [mark=*] coordinates {(marker-|0,0)}; \else \tikzset{options/.style={mark=none}} \fi }{ \tikzset{options/.style={mark=none}}
} \coordinate (marker) at (0,0); \begin{scope}[options] }, scatter/@post marker code/.code={\end{scope}} } }

\makeatother

\begin{document}

\pgfplotsset{
    standard/.style={
        axis x line=middle,
        axis y line=middle,
        enlarge x limits=0.05,
        enlarge y limits=0.05,
        every axis x label/.style={at={(current axis.right of origin)},anchor=north west},
        every axis y label/.style={at={(current axis.above origin)},anchor=north east}
    }
}

{\centering
    \begin{tikzpicture}
        \begin{axis}[
            standard,
            clip=false,
            jump mark left,
            ymin=0,ymax=1,
            xmin=0, xmax=6,
            xlabel={$t$},
            xtick distance={.5},
            ylabel={$X(t)$},
            yticklabels={,,},
            xtick style={draw=none},
            ytick style={draw=none},
            %axis lines=middle,
            %axis line style={-},
            %ylabel near ticks,
            %xlabel near ticks,
            xticklabels={,,,$t_0$,,$t_1$,,,,$t_2$,$t_3$,,,$t_4$},
            every axis plot/.style={very thick},
            discontinuous,
            table/create on use/cumulative distribution/.style={
                create col/expr={\pgfmathaccuma + \thisrow{f(x)}}   
            }
            ]
            \path (0,0) coordinate (O);
            \addplot [orange] table [y=cumulative distribution]{
                x f(x)
                1 2/15
                2 1/5
                4 4/15
                4.5 1/3
                6 0
            };
        \end{axis}
    \end{tikzpicture}
    \par}

\end{document}

itc
  • 657
  • 1
    What is wrong about scaling? Note that you should scale the axis, not the tikzpicture. See also this answer for scaling the axis: https://tex.stackexchange.com/a/680555/237192 – Οὖτις Mar 24 '23 at 16:29
  • Thanks, I was making a mistake of scaling the tikzpicture itself instead of the axis. The link you referred to me helped a lot. – itc Mar 25 '23 at 00:30

0 Answers0