如何旋转椭圆

如何旋转椭圆

我正在并排绘制旋转椭圆和双曲线,以说明二次函数中交叉积项的影响。我正在通过 pgfmanual.pgf 学习在 tikz 中绘图。我发现获取我想要的东西并不容易,所以学习很慢。我确实通过这个论坛上的各种帖子获得了一些代码。我还有一些问题需要解决,对此我将非常感激您的帮助。它们是:1. 在椭圆上无法放置轴标签(我可以正常旋转它);2. 我根本无法旋转双曲线。代码如下:

\documentclass[11pt,twoside]{report}
\usetikzlibrary{shapes.geometric, arrows, decorations.pathreplacing, matrix}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{scope}[remember picture,rotate=45]
    \coordinate (O) at (0,0);
\coordinate (A) at (2.5,0);
\coordinate (B) at (0,1.6);
% draw ellipse
    \draw[line width = 0.5mm] (O) ellipse (2.5cm and 1.60cm);
% draw axis
\draw[line width = 0.5mm, ->] (-2.5, 0) -- (2.5, 0) coordinate[right] (e1);
\draw[line width = 0.5mm, ->] (0, -2.5) -- (0, 2.5) coordinate[above] (e2);
% calculate brace points for major axis
\path (O) -- (A) coordinate[pos=.02] (a1) coordinate[pos=.98] (a2);
\draw[decorate, decoration = {brace, amplitude = 12pt, mirror, raise =4pt}, yshift = 0pt]
    (a2) -- (a1) coordinate[midway] (tl1);
\coordinate (l1) at ([yshift=1cm]tl1);
% calculate brace points for minor axis
\path (O) -- (B) coordinate[pos=.05] (b1) coordinate[pos=.95] (b2);
\draw[decorate, decoration = {brace, amplitude = 12pt, mirror, raise =4pt}, yshift = 0pt]
    (b2) -- (b1) coordinate[midway] (tl2);
\coordinate (l2) at ([xshift=-.9cm]tl2);
\end{scope}

\draw[line width = 0.5mm, dashed, ->] (-2.5, 0) -- (2.5, 0) node[right]{$x$};
\draw[line width = 0.5mm, dashed, ->] (0, -2.5) -- (0, 2.5) node[above]{$y$};
\node[anchor=south west] at (e1) {$x^{'}$};
\node[anchor=south east] at (e2) {$y^{'}$};
\node[anchor=south west] at ([xshift=-0.1cm,yshift=-0.4cm]l1) {$a$};
\node[anchor=south east] at ([xshift=.2cm]l2) {$b$};
\end{tikzpicture}
%******

\begin{tikzpicture}
\begin{axis}[
        xmin=-2.5,xmax=2.5,
    ymin=-2.5,ymax=2.5]
    all axes={ticks=few}
    \addplot [black,ultra thick,domain=-1:1] ({cosh(x)}, {sinh(x)});
    \addplot [black,ultra thick,domain=-1:1] ({-cosh(x)}, {sinh(x)});
    \addplot[red,dashed] expression {x};
    \addplot[red,dashed] expression {-x};
    \end{axis}
\end{tikzpicture}\\
\end{document}

任何帮助都将不胜感激。

相关内容