如何修改节点样式而不改变位置

如何修改节点样式而不改变位置

我有一张图,我想在原始黑色上覆盖一层浓红色。问题是,当我添加非常浓的选项时,节点的位移越来越大。

\documentclass{beamer}
\usepackage{adjustbox}

\usepackage{tikz}
\usetikzlibrary{shapes, shadows, arrows, positioning}

\tikzstyle{agent} = [diamond, draw, node distance= 7em, minimum height=5em, minimum width=5em]
\tikzstyle{line} = [draw, -stealth]
\tikzstyle{inp} = [draw, circle, text centered, minimum height=2mm, text width=2em, node distance= 10em]
\tikzstyle{outp} = [draw, ellipse, text centered, minimum height=2mm, text width=2em, node distance= 10em]


\newcommand{\asd}[1]{

}

\usetheme{Madrid}

\begin{document}
\begin{frame}
\begin{adjustbox}{max totalsize={1\textwidth}{.8\textheight},center}
\begin{tikzpicture}

%%%%%Researcher 1 and Inputs: depends on R_1%%%%%%%
\node [inp](R_1){R};
\node [inp, left of=R_1, xshift=15em](D_1){D};
\node [agent, below of=D_1](Researcher_1){$R_1$};
\node [agent, below =5em of Researcher_1](PA_1){$PA_1$};
\node [agent, below =6em of PA_1](PM_1){$PM_1$};
\node [outp, below = 3.5em of PM_1](PC_1){$PC_1$};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%% Draw edges col 1%%%%%%%%%%%%%%%%%
%Research 1
\draw [line](D_1) -- (Researcher_1);
\draw [line](R_1) -- (Researcher_1);
\draw [line](Researcher_1) -- (PA_1);
\draw [line](PA_1) -- (PM_1);
\draw [line](PM_1) -- (PC_1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\node [inp, color=red, very thick](R_1){R};
\draw [line, color=red, very thick](R_1) -- (Researcher_1);
\node [agent, below of=D_1, color=red, very thick](Researcher_1){$R_1$}; 
\draw [line, color=red, very thick](Researcher_1) -- (PA_1);
\node [agent, below =5em of Researcher_1 , color=red, very thick](PA_1){$PA_1$};
\draw [line, color=red, very thick](PA_1) -- (PM_1);
\node [agent, below =6em of PA_1, color=red, very thick](PM_1){$PM_1$};
\draw [line, color=red, very thick](PM_1) -- (PC_1);
\node [outp, below = 3.5em of PM_1, color=red, very thick](PC_1){$PC_1$};

\end{tikzpicture}
\end{adjustbox}
\end{frame}

\end{document}

你能说出问题出在哪里吗?

答案1

节点outer sep的初始值为.5\pgflinewidth。因此它取决于节点边框线的粗细。

outer sep一种可能性是对整个图片使用一个固定值:

\begin{tikzpicture}[outer sep=.2pt]

结果:

在此处输入图片描述

相关内容