早上好,我正在用共轭直径画一个椭圆。我的 MWE
\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
\begin{axis}[domain=0:360,no markers]
\pgfplotsinvokeforeach{-4,-3,-2,-1,0,1,2,3,4}{
\addplot ({x/360},{#1+x/360});
\addplot ({#1+x/360},{#1-1.07*x/360});
\addplot ({5*sin(x)},{4*cos(x)});
}
\end{axis}
\end{tikzpicture}
\end{document}
问题 - 如何使直线足够长?如何使椭圆更平滑?谢谢!
答案1
我不知道conjugate diameters
是什么,但是有了ellipse
形状节点及其极地锚,就可以很容易地在椭圆边界上的任意两点之间画线。
\documentclass[border=2mm]{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
\node[ellipse, draw, minimum width=3cm, minimum height=2cm] (A) {};
\draw (A.30)--(A.210);
\draw (A.40)--(A.200);
\draw (A.120)--(A.300);
\end{tikzpicture}
\end{document}
答案2
好的,根据以上所有建议,我得出了以下结论
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[help lines/.style={blue!30,very thin},scale=0.6]
\draw [help lines] (-6, -3) grid (6, 3);
\draw[->] (-6, 0) -- (6, 0) node[below]{\footnotesize $x$};
\draw[->] (0, -3) -- (0, 3) node[right]{\footnotesize $y$};
\draw[color=blue,very thick] (0, 0) ellipse (4cm and 2cm);
\draw[-,green!50!black] (2, -2) -- (5, 1) ;
\draw[-,green!50!black] (1, -2) -- (4, 1) ;
\draw[-,green!50!black] (0, -2) -- (4, 2);
\draw[-,green!50!black] (-1, -2) -- (3, 2);
\draw[-,green!50!black] (-2, -2) -- (2, 2);
\draw[-,green!50!black] (-5, -1) -- (-2, 2) ;
\draw[-,green!50!black] (-4, -1) -- (-1, 2) ;
\draw[-,green!50!black] (-4, -2) -- (0, 2) ;
\draw[-,green!50!black] (-3, -2) -- (1, 2) ;
\draw[-,red] (-4, 1) -- (4, -1) ;
\draw[-,red] (-3, 2) -- (5, 0) ;
\draw[-,red] (-5, 0) -- (3, -2);
\end{tikzpicture}
\end{document}