
を使って楕円の一部を描こうとしていました\pgfpatharcto
。しかし、元の完全な楕円と比べてみると、少し違いがありました。結果とコードを添付します。
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\draw (2.5cm,0) ellipse (3.5cm and 3.8436cm);
\pgfsetstrokecolor{red}
\pgfmoveto{\pgfpoint{2.841cm}{3.8284cm}}
\pgfpatharcto{3.5cm}{3.8436cm}{0}{0}{0}{\pgfpoint{2.841cm}{-3.8284cm}}\pgfusepath{stroke};
\end{tikzpicture}
\end{document}
答え1
楕円を 2 回描画することもできますが、2 回目はクリッピング スコープ内で描画します。
\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\draw (2.5cm,0) ellipse (3.5cm and 3.8436cm);
\begin{scope}
\clip (2.5cm,0)--++(80:3.9) arc(80:-80:3.9)--cycle;
\draw[red] (2.5cm,0) ellipse (3.5cm and 3.8436cm);
\end{scope}
\end{tikzpicture}
\end{document}
答え2
試してみるといいかもしれませんメタポストこれを行うには、subpath
保存したパスのセグメントを描画できる便利な構文があります。 でコンパイルしますlualatex
。
\RequirePackage{luatex85}
\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
path e;
e = fullcircle xscaled 3.5cm yscaled 3.8436cm;
draw e withpen pencircle scaled 2 withcolor .8 white;
draw subpath (-2,2) of e withcolor 2/3 red;
endfig;
\end{mplibcode}
\end{document}
Metapost は、パスに沿って「時間」の概念を提供します。fullcircle
パスには、いわば「3 時」のポイント 0 から始まる 8 つの時間ポイントがあります。
つまり、subpath (0,2) of c
3 時から正午までとなります。小数も使用できますsubpath (2.718, 3.1415) of c
。
また、私の例で示したように、負の数を使用して、ポイント 0 より「前の」ポイントを参照することもできます。