
コマンドを使用して楕円と線の交差部分を強調表示できません\clip
。助けてください。ここでは、領域 ABCD を塗りつぶしたいのですが、ご指導ください。ありがとうございます。
\documentclass{article}
\usepackage{tikz,pgfplots}
%\usepackage[x11names]{xcolor}
\usepackage{tikz}
\usetikzlibrary{intersections}
\usepackage{pgfplots}\pgfplotsset{compat=newest}
\pgfdeclarelayer{bg} % declare background
\pgfsetlayers{bg,main} % order of layers (main = standard layer)
\pgfplotsset{compat=1.13}
\usepackage{amsmath}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\draw (0,-2)--(0,3);
\draw (-4,0)--(5,0);
\draw (0,0)node(o){O} (0,1)[left]node(c){C} (0,-1)node(d){D};
\draw(0,0)circle[x radius = 3 cm , y radius = 1 cm]; % DRAW ELLIPSE
\draw (1,-1)[below]node(a){A}--(1,1)[above]node(b){B};
\clip(0,0)circle[x radius = 3 cm , y radius = 1 cm];
\fill[black] (0cm,0cm) rectangle (4cm,6cm);
\draw (0,0)node(o){O} (0,1)[left]node(c){C};
\end{tikzpicture}
\end{document}
答え1
このようなものをお望みですか? 目に見える結果が得られない理由は、幅がゼロの四角形を塗りつぶしているためです。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,-2)--(0,3);
\draw (-4,0)--(5,0);
\draw(0,0)circle[x radius = 3 cm , y radius = 1 cm]; % DRAW ELLIPSE
\draw (1,-1)[below]node(a){A}--(1,1)[above]node(b){B};
\clip(0,0)circle[x radius = 3 cm , y radius = 1 cm];
\draw[blue,thick] (a) -- (b);
\end{tikzpicture}
\end{document}
更新された質問に関しては、点a
、b
、c
をd
拡張オブジェクトであるノードとして定義します。そのため、これらの点を接続するパスにはギャップがあり、 は失敗します。これを回避するには、ラベル付きのタイプ ノードfill
を使用します。coordinate
\documentclass{article}
\usepackage{tikz}
\pgfdeclarelayer{bg}
\pgfsetlayers{bg,main}
\begin{document}
\begin{tikzpicture}
\draw (0,-2) -- (0,3);
\draw (-4,0) -- (5,0);
\draw (0,0)circle[x radius = 3 cm , y radius = 1 cm]; % DRAW ELLIPSE
\draw (1,-1)coordinate[label=below:$A$](a)
-- (1,1)coordinate[label=above:$B$](b);
\draw (0,0)coordinate[label=below left:$O$](o)
(0,1)coordinate[label=left:$C$](c)
(0,-1)coordinate[label=below:$D$](d);
\begin{pgfonlayer}{bg}
\clip (0,0) circle[x radius = 3 cm , y radius = 1 cm];
\fill[blue] (a) -- (b) -- (c) -- (d) -- cycle;
\end{pgfonlayer}
\end{tikzpicture}
\end{document}