当在 Tex Studio 中查看我的输出时,45 度线图案呈现应如此处所示:
在 Adobe 或 Sumatra 中查看时,我得到以下信息: 缩小并不能使它变得更好,只有放大才能极其close 线条是否正确呈现。我使用其他 Tikz 库时没有遇到过这个问题,我不知道发生了什么。其他人也遇到过类似的问题,但他们的解决方案不适用于我的情况。
这里:
\documentclass{standalone}
\usepackage{color}
\usepackage{tikz}
\usetikzlibrary{calc,matrix,arrows,arrows.meta,decorations.pathmorphing,decorations.markings,math,shapes.misc, positioning, shapes.geometric, intersections, quotes, angles, positioning, patterns, patterns.meta}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\begin{document}
\begin{tikzpicture}[declare function = {
h(\x) = sqrt((2*sin(2*pi*\x/0.02 r))^2);
},
]
\begin{axis}[
clip=false,
title=\large{\textbf{RMS Visualised}},
title style={yshift=7mm,},
xlabel={Time (s)},
ylabel={Voltage (V)},
axis lines = middle,
xmin=0, xmax=.021,
xtick={0,0.01,0.02},
xticklabel style={
/pgf/number format/fixed,
/pgf/number format/precision=2,
},
scaled x ticks=false,
yticklabel=\empty,
xticklabel=\empty,
ytick style={draw=none},
width=0.8\textwidth,
height=0.4\textwidth,
scale=1,
every axis x label/.style={
at={(ticklabel* cs:1.00)},
anchor=west, right=1mm,
},
every axis y label/.style={
at={(ticklabel* cs:1.00)},
anchor=south, above=1mm,
},
samples = 100,
axis line style = {-{Stealth[scale=1.0]}, thick}, %,
every axis plot/.append style={thick},
]
\addplot[color=green, domain=0:0.02]{h(\x)} node[above, pos=0.75] {$\sqrt{V^2}$};
\draw[-, thick, color= violet] (axis cs:0,{2/sqrt(2)}) -- (axis cs:0.02,{2/sqrt(2)}) node[right] {$V_{_{\mathrm{RMS}}}$};
\fill[pattern color=violet, fill opacity=1, pattern={Lines[angle=45, line width=0.8pt, distance= 2mm]}] (axis cs:0,0) rectangle (axis cs:0.02,{2/sqrt(2)});
\end{axis}
\end{tikzpicture}
\end{document}