我想在下面的代码中对单位圆的外部进行着色,以获得这种效果:
这是我的代码:
\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[scale=1.5]
% Axes:
\draw [-latex] (-1.5,0) -- (1.5,0) node [above left] {$\Re$};
\draw [-latex] (0,-1.5) -- (0,1.5) node [below right] {$\Im$};
\draw[dashed] (0cm,0cm) circle(1cm);
\node[solid, cross out, draw=black] at (-0.9,0) {};
\node[solid, cross out, draw=black] at (-0.5,0) {};
\node[solid, cross out, draw=black] at (0.75,0) {};
\node[solid, cross out, draw=black] at (0.3,0.3) {};
\node[solid, cross out, draw=black] at (0.3,-0.3) {};
\node[solid, cross out, draw=black] at (0.3,0) {};
\end{tikzpicture}
\caption{Pole plot for $Q(z)$ in the $Z$ plane.}
\label{polezero1}
\end{figure}
\end{document}
答案1
我会避免用白色填充内圈,而是使用even odd rule
阴影。这样可以确保任何彩色背景都能显示出来。(当然,如果你想要一个白色的内圈,你应该不是用这个方法!)
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
\begin{document}
\begin{tikzpicture}
\shade [inner color=red, outer color=white, even odd rule] circle (1.5) circle (1);
% Axes:
\draw [-latex] (-1.5,0) -- (1.5,0) node [above left] {$\Re$};
\draw [-latex] (0,-1.5) -- (0,1.5) node [below right] {$\Im$};
\draw[dashed] (0cm,0cm) circle(1cm);
\node[solid, cross out, draw=black] at (-0.9,0) {};
\node[solid, cross out, draw=black] at (-0.5,0) {};
\node[solid, cross out, draw=black] at (0.75,0) {};
\node[solid, cross out, draw=black] at (0.3,0.3) {};
\node[solid, cross out, draw=black] at (0.3,-0.3) {};
\node[solid, cross out, draw=black] at (0.3,0) {};
\end{tikzpicture}
\end{document}
答案2
像这样?我不确定你是想阴影上半部分还是整个外圆,如果是后者,则删除scope
(第 11 和 14 行)并剪切(第 12 行\path[clip] ..
:)。
\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[scale=1.5, > = latex]
\begin{scope}
\path[clip] (-1.5,0) rectangle (1.5,1.5);
\path [inner color=red, outer color=white] (0cm,0cm) circle(1.5cm);
\end{scope}
\draw[dashed,fill=white] (0cm,0cm) circle(1cm);
% Axes:
\draw [->] (-1.5,0) -- (1.5,0) node [above left] {$\Re$};
\draw [->] (0,-1.5) -- (0,1.5) node [below right] {$\Im$};
\node[solid, cross out, draw=black] at (-0.9,0) {};
\node[solid, cross out, draw=black] at (-0.5,0) {};
\node[solid, cross out, draw=black] at (0.75,0) {};
\node[solid, cross out, draw=black] at (0.3,0.3) {};
\node[solid, cross out, draw=black] at (0.3,-0.3) {};
\node[solid, cross out, draw=black] at (0.3,0) {};
\end{tikzpicture}
\caption{Pole plot for $Q(z)$ in the $Z$ plane.}
\label{polezero1}
\end{figure}
\end{document}