![在 Tikz 中删除线条的边框](https://linux22.com/image/437579/%E5%9C%A8%20Tikz%20%E4%B8%AD%E5%88%A0%E9%99%A4%E7%BA%BF%E6%9D%A1%E7%9A%84%E8%BE%B9%E6%A1%86.png)
我正在使用 Tikz 绘制一些图表。
但是,当我使用时,\draw [shift={(232.14,97)}, rotate = 90] [fill={rgb, 255:red, 115; green, 201; blue, 255 } ,fill opacity=1 ][line width=0.01] [draw opacity=0] (4.8,-1.2) -- (0,0) -- (4.8,1.2) -- cycle ;
物体周围仍然有一条黑线:
完整代码:
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,300); %set diagram left start at 0, and has height of 300
%Straight Lines [id:da22349387736428006]
\draw [dash pattern={on 0.84pt off 2.51pt}] (260,130) -- (232,110.6) ;
%Straight Lines [id:da29311458312574956]
\draw [dash pattern={on 0.84pt off 2.51pt}] (139.14,115.82) -- (120,120) ;
%Straight Lines [id:da05623331520653507]
\draw (139.14,114.82) -- (180,131.17) -- (231,110.33) ;
%Shape: Circle [id:dp7665677720333088]
\draw [fill={rgb, 255:red, 128; green, 128; blue, 128 } ,fill opacity=1 ][dash pattern={on 3.75pt off 3pt on 7.5pt off 1.5pt}] (135.64,115.82) .. controls (135.64,113.89) and (137.2,112.32) .. (139.14,112.32) .. controls (141.07,112.32) and (142.64,113.89) .. (142.64,115.82) .. controls (142.64,117.75) and (141.07,119.32) .. (139.14,119.32) .. controls (137.2,119.32) and (135.64,117.75) .. (135.64,115.82) -- cycle ;
%Shape: Circle [id:dp193113222269232]
\draw [fill={rgb, 255:red, 128; green, 128; blue, 128 } ,fill opacity=1 ][dash pattern={on 3.75pt off 3pt on 7.5pt off 1.5pt}] (176.5,130.17) .. controls (176.5,128.23) and (178.07,126.67) .. (180,126.67) .. controls (181.93,126.67) and (183.5,128.23) .. (183.5,130.17) .. controls (183.5,132.1) and (181.93,133.67) .. (180,133.67) .. controls (178.07,133.67) and (176.5,132.1) .. (176.5,130.17) -- cycle ;
%Shape: Circle [id:dp9306623067288149]
\draw [fill={rgb, 255:red, 128; green, 128; blue, 128 } ,fill opacity=1 ][dash pattern={on 3.75pt off 3pt on 7.5pt off 1.5pt}] (228.5,110.6) .. controls (228.5,108.66) and (230.07,107.1) .. (232,107.1) .. controls (233.93,107.1) and (235.5,108.66) .. (235.5,110.6) .. controls (235.5,112.53) and (233.93,114.1) .. (232,114.1) .. controls (230.07,114.1) and (228.5,112.53) .. (228.5,110.6) -- cycle ;
%Shape: Circle [id:dp08269290559401243]
\draw [fill={rgb, 255:red, 184; green, 233; blue, 134 } ,fill opacity=1 ][dash pattern={on 3.75pt off 3pt on 7.5pt off 1.5pt}] (136.35,94.82) .. controls (136.35,92.89) and (137.92,91.32) .. (139.85,91.32) .. controls (141.79,91.32) and (143.35,92.89) .. (143.35,94.82) .. controls (143.35,96.75) and (141.79,98.32) .. (139.85,98.32) .. controls (137.92,98.32) and (136.35,96.75) .. (136.35,94.82) -- cycle ;
%Shape: Circle [id:dp6993402699496214]
\draw [fill={rgb, 255:red, 184; green, 233; blue, 134 } ,fill opacity=1 ][dash pattern={on 3.75pt off 3pt on 7.5pt off 1.5pt}] (176.5,150.31) .. controls (176.5,148.38) and (178.07,146.81) .. (180,146.81) .. controls (181.93,146.81) and (183.5,148.38) .. (183.5,150.31) .. controls (183.5,152.24) and (181.93,153.81) .. (180,153.81) .. controls (178.07,153.81) and (176.5,152.24) .. (176.5,150.31) -- cycle ;
%Shape: Circle [id:dp6125576427238653]
\draw [fill={rgb, 255:red, 184; green, 233; blue, 134 } ,fill opacity=1 ][dash pattern={on 3.75pt off 3pt on 7.5pt off 1.5pt}] (228.5,91.17) .. controls (228.5,89.23) and (230.07,87.67) .. (232,87.67) .. controls (233.93,87.67) and (235.5,89.23) .. (235.5,91.17) .. controls (235.5,93.1) and (233.93,94.67) .. (232,94.67) .. controls (230.07,94.67) and (228.5,93.1) .. (228.5,91.17) -- cycle ;
%Straight Lines [id:da0822256545819966]
\draw [color={rgb, 255:red, 115; green, 201; blue, 255 } ,draw opacity=1 ] (180.43,136.71) -- (180.43,143.29) ;
\draw [shift={(180.43,145.29)}, rotate = 270] [fill={rgb, 255:red, 115; green, 201; blue, 255 } ,fill opacity=1 ][line width=0.08] [draw opacity=0] (4.8,-1.2) -- (0,0) -- (4.8,1.2) -- cycle ;
%Straight Lines [id:da7978560807556065]
\draw [color={rgb, 255:red, 115; green, 201; blue, 255 } ,draw opacity=1 ][fill={rgb, 255:red, 115; green, 201; blue, 255 } ,fill opacity=1 ] (140,103.43) -- (140,107.48) -- (140,110) ;
\draw [shift={(140,101.43)}, rotate = 90] [fill={rgb, 255:red, 115; green, 201; blue, 255 } ,fill opacity=1 ][line width=0.08] [draw opacity=0] (4.8,-1.2) -- (0,0) -- (4.8,1.2) -- cycle ;
%Straight Lines [id:da5331445738451293]
\draw [color={rgb, 255:red, 115; green, 201; blue, 255 } ,draw opacity=1 ] (232.14,99) -- (232.14,105.57) ;
\draw [shift={(232.14,97)}, rotate = 90] [fill={rgb, 255:red, 115; green, 201; blue, 255 } ,fill opacity=1 ][line width=0.01] [draw opacity=0] (4.8,-1.2) -- (0,0) -- (4.8,1.2) -- cycle ;
%Straight Lines [id:da6900959224002201]
\draw [color={rgb, 255:red, 0; green, 0; blue, 0 } ,draw opacity=1 ] (177.78,122.54) -- (172.14,109.86) ;
\draw [shift={(179,125.29)}, rotate = 246.04] [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ][line width=0.08] [draw opacity=0] (3.57,-1.72) -- (0,0) -- (3.57,1.72) -- cycle ;
%Straight Lines [id:da593624024668693]
\draw [color={rgb, 255:red, 0; green, 0; blue, 0 } ,draw opacity=1 ] (188.44,147.19) -- (199.86,140.43) ;
\draw [shift={(185.86,148.71)}, rotate = 329.38] [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ][line width=0.08] [draw opacity=0] (3.57,-1.72) -- (0,0) -- (3.57,1.72) -- cycle ;
%Straight Lines [id:da12254190749709593]
\draw (113,160) -- (277,160) ;
\draw [shift={(280,160)}, rotate = 180] [fill={rgb, 255:red, 0; green, 0; blue, 0 } ][line width=0.08] [draw opacity=0] (3.57,-1.72) -- (0,0) -- (3.57,1.72) -- cycle ;
\draw [shift={(110,160)}, rotate = 0] [fill={rgb, 255:red, 0; green, 0; blue, 0 } ][line width=0.08] [draw opacity=0] (3.57,-1.72) -- (0,0) -- (3.57,1.72) -- cycle ;
%Straight Lines [id:da007746876971784333]
\draw (140,156) -- (140,160) ;
%Straight Lines [id:da3974779179972072]
\draw (180,156) -- (180,160) ;
%Straight Lines [id:da555126001881239]
\draw (230,156) -- (230,160) ;
% Text Node
\draw (151.43,92.94) node [anchor=north west][inner sep=0.75pt] [font=\tiny,color={rgb, 255:red, 128; green, 128; blue, 128 } ,opacity=1 ] [align=left] {$\displaystyle \mathcal{N}\left( \theta _{t} |\mu _{t}^{-} ,\ \mathbf{C}_{t}^{-}\right)$};
% Text Node
\draw (200.57,130.94) node [anchor=north west][inner sep=0.75pt] [font=\tiny,color={rgb, 255:red, 128; green, 128; blue, 128 } ,opacity=1 ] [align=left] {$\displaystyle \mathcal{N}\left( \theta _{t} |\mu _{t}^{+} ,\ \mathbf{C}_{t}^{+}\right)$};
% Text Node
\draw (116,100.8) node [anchor=north west][inner sep=0.75pt] [font=\tiny,color={rgb, 255:red, 115; green, 201; blue, 255 } ,opacity=1 ] [align=left] {$\displaystyle y_{t-1}$};
% Text Node
\draw (166.57,135.8) node [anchor=north west][inner sep=0.75pt] [font=\tiny,color={rgb, 255:red, 115; green, 201; blue, 255 } ,opacity=1 ] [align=left] {$\displaystyle y_{t}$};
% Text Node
\draw (238,96.8) node [anchor=north west][inner sep=0.75pt] [font=\tiny,color={rgb, 255:red, 115; green, 201; blue, 255 } ,opacity=1 ] [align=left] {$\displaystyle y_{t+1}$};
% Text Node
\draw (131,161.8) node [anchor=north west][inner sep=0.75pt] [font=\tiny] [align=left] {$\displaystyle t-1$};
% Text Node
\draw (177,161.8) node [anchor=north west][inner sep=0.75pt] [font=\tiny] [align=left] {$\displaystyle t$};
% Text Node
\draw (221,161.8) node [anchor=north west][inner sep=0.75pt] [font=\tiny] [align=left] {$\displaystyle t+1$};
% Text Node
\draw (128,71.8) node [anchor=north west][inner sep=0.75pt] [align=left] {{\tiny smoothing $\leftarrow$ filtering $\rightarrow$ prediction}};
\end{tikzpicture}
编辑:我擅自添加了由您的代码片段生成的图像。
答案1
我猜你正在寻找这样的东西:
当我将你的代码片段插入我的 MWE 而不是我的图像代码时,我得到了类似的结果(我在你的问题中展示了它)。所以,不清楚为什么你会得到不同的结果。无论如何,你应该提供完整的小文档(MWE:最小工作示例)而不是代码片段,以重现你的结果。
但是,你的代码被狙击得很糟糕。mathcha.io 实用程序(根据我的观点,但这里有不同意我的观点的用户)大多会生成垃圾代码(或者你没有充分使用它)...对于严肃的工作,你至少应该学习 Ti钾Z 并tikzpicture
直接在 LaTeX 编辑器中编码。这样做,您的问题就不会发生。例如:
\documentclass[border=3.141592]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
positioning,
quotes}
\begin{document}
\begin{tikzpicture}[
> = {Triangle[scale=0.8]},
arr/.style = {-{Triangle[length=2.4mm, width=1mm]}, color=cyan,
shorten >=1mm, shorten <=1mm},
C/.style = {circle, draw, dashed, fill=#1, inner sep=2pt},
N/.style = {inner sep=2pt, font=\scriptsize},
every pin/.style = {pin distance=5mm,
pin edge={<-,shorten <=1pt, draw=black},
inner sep=1pt, font=\scriptsize, text=gray}
]
% x-axis
\draw[<->] (-4,0) -- (4,0);
\foreach \i [count=\x from -1, count=\j] in {$t-1$, $t$, $t+1$}
\draw (3*\x,0.1) -- ++ (0,-0.2) node (n\j) [N, below] {\i};
% gray circles
\node (g1) [C=gray, above=24 mm of n1] {};
\node (g2) [C=gray, above=15 mm of n2,
pin={90:$\mathcal{N}\left(\theta_{t}\vert\mu_{t}^{-},\mathbf{C}_{t}^{-}\right)$}] {};
\node (g3) [C=gray, above=24 mm of n3] {};
\draw(g1) -- (g2) -- (g3);
% green circles
\node (c1) [C=green, above=7 mm of g1] {};
\node (c2) [C=green, below=7 mm of g2,
pin={0:$\mathcal{N}\left(\theta_{t}\vert\mu_{t}^{+},\mathbf{C}_{t}^{+}\right)$}] {};
\node (c3) [C=green, above=7 mm of g3] {};
% cyan arrows
\draw[arr] (g1) to [N, "$y(t-1)$"] (c1);
\draw[arr] (g2) to [N, "$y(t)$"] (c2);
\draw[arr] (g3) to [N, "$y(t+1)$"] (c3);
% legend
\node [above=22mm of g2] {smoothing $\leftarrow$ filtering $\rightarrow$ prediction};
\end{tikzpicture}
\end{document}