我试图在原点处绘制一个圆形节点,同时保持 y 轴在左侧,x 轴在底部。节点结果为四分之一圆。如何在保留轴的同时保持其为整圆?
下面是我正在使用的代码。
\begin{tikzpicture}[baseline]
\begin{axis}[
axis y line = left,
axis x line=bottom,
xlabel = t,
xtick = {\empty},
ytick = {\empty},
]
\addplot [
domain=-6:6,
samples=100,
color=gray,
line width = 0.55mm,
]
{1/(1+exp(-\x))};
\draw[fill] (0,0) circle[radius=3pt];
\end{axis} ;
\end{tikzpicture}
}
谢谢你!
答案1
一种可能性是
after end axis/.code={\draw[fill] (current axis.origin) circle[radius=3pt];}
以避免节点在轴的边界处被剪裁。相反,(current axis.origin)
您也可以(axis cs:0,0)
在上面的代码中使用。
\documentclass[margin=5pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}[baseline]
\begin{axis}[
axis y line = left,
axis x line=bottom,
xlabel = t,
xtick = {\empty},
ytick = {\empty},
after end axis/.code={\draw[fill] (current axis.origin) circle[radius=3pt];}
]
\addplot [
domain=-6:6,
samples=100,
color=gray,
line width = 0.55mm
]
{1/(1+exp(-\x))};
\end{axis}
\end{tikzpicture}
\end{document}
答案2
我会用
\addplot[color=black,only marks,mark=*] (-6,0);
这使
以下是完整的 MWE:
% arara: pdflatex
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis y line = left,
axis x line=bottom,
xlabel = t,
xtick = {\empty},
ytick = {\empty},
]
\addplot [
domain=-6:6,
samples=100,
color=gray,
line width = 0.55mm,
]
{1/(1+exp(-\x))};
\addplot[color=black,only marks,mark=*] (-6,0);
\end{axis}
\end{tikzpicture}
\end{document}