我正在努力增加 tikzpicture 的大小。当我在或article
类中加载代码时book
,图表很小。我尝试了该scale
命令,但结果输出非常糟糕。以下是 MWE,这是对我的问题提供的解决方案添加彩色垂直虚线并删除水平线上的圆圈。
\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}