旧答案

旧答案

我想画一条曲线,给人一种将一个轴映射到另一个轴的印象,上面有希腊字符 rho,就像下面的图片一样。

我还希望在轴的交叉点处有一个小正方形,给人一种角度是直角的印象。

到目前为止,我有下面的代码(部分取自该站点上已有的一些代码)。

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{center}
\begin{tikzpicture}[scale=.5]
\draw [dashed] (2,2) --  (4, 4);
\draw [->] (4, 4) -- (5.5, 5.5); 
\draw [dashed] (2,2) --  (-.25, 3.678) ; 
\draw [->] (-.25, 3.687) -- (-2, 5); 
\draw (2,2) circle (3cm);
\draw[dashed] (2,2) ellipse (3cm and 1cm);
\clip (-1.1,2) rectangle (5.1 cm, 0.9 cm);
\draw (2,2) ellipse (3cm and 1cm); 
\end{tikzpicture}
\end{center}
\end{document}

输出

答案1

如果您使用极坐标绘制图表,则可以使用 来arc绘制该箭头。下面的代码中有一些注释,如果您需要更多说明,请询问。

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{tikzpicture}[
  declare function={
   R=2cm; % radius
   theta=45; % angle of right arrow
   }]
% draw circle, and place coordinate at center
\draw (1,1) coordinate (O) circle[radius=R];
% define two helper coordinates, where the dashed lines should meet the circle
\path (O) +(theta:R) coordinate (a)
          +(theta+90:R) coordinate (b);
% draw arc with solid part of equator
\draw (O) ++(R,0) arc[start angle=0,delta angle=-180,x radius=R,y radius=R/3];
% draw ard for dashed part of equator
\draw [dashed] (O) ++(R,0) arc[start angle=0,delta angle=180,x radius=R,y radius=R/3];
% draw the dashed lines to the center of the circle
\draw [dashed] (a) -- (O) -- (b);
% draw the two arrows that extend out of the circle
\draw [-latex] (O) ++(theta:R) -- ++(theta:0.75*R);
\draw [-latex] (O) ++(theta+90:R) -- ++(theta+90:0.75*R);

% draw the arced arrow with rho above
\draw [-latex] (O) ++(theta+80:R*1.2)
  arc[start angle=theta+80,delta angle=-70,radius=R*1.2]
  node[midway,above] {$\rho$};

% draw the right angle mark
\draw (O) ++(theta:R/10) -- ++(theta+90:R/10) -- ++(180+theta:R/10);
\end{tikzpicture}
\end{center}
\end{document}

旧答案

或者,您可以使用由库定义的预定义pic名称,即。标签需要该库。angleanglesquotes"$\rho$"

我建议用稍微不同的方法制作该图,但也将箭头添加到代码中。虽然还没有完成那里的正方形部分,但那里的角度不是 90 度(在您的图中)。尝试\draw [rotate around={45:(2,2)}] (2,2) rectangle (2.5,2.5);在之前添加\clip以查看。

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{angles,quotes,bending}
\begin{document}
\begin{center}
\begin{tikzpicture}[declare function={R=1.5cm;theta=45;}]
\draw (0,0) coordinate (O) circle[radius=R];
\draw (R,0) arc[start angle=0,delta angle=-180,x radius=R,y radius=R/3];
\draw [dashed] (R,0) arc[start angle=0,delta angle=180,x radius=R,y radius=R/3];
\draw [dashed] (180-theta:R) -- (O) -- (theta:R);
\draw [-latex] (theta:R) -- (theta:1.5*R) coordinate (a);
\draw [-latex] (180-theta:R) -- (180-theta:1.5*R) coordinate (b);
\draw pic [
     shorten >=2mm,
     shorten <=2mm,
     draw,
     latex-,
     angle radius=1.2*R,
     angle eccentricity=1.1,
     "$\rho$"] {angle=a--O--b};

\draw (O) ++(theta:R/10) -- ++(180-theta:R/10) -- ++(180+theta:R/10);
\end{tikzpicture}
\begin{tikzpicture}[scale=.5]
\draw [dashed] (2,2) coordinate (O) --  (4, 4);
\draw [->] (4, 4) -- (5.5, 5.5) coordinate (a); 
\draw [dashed] (2,2) --  (-.25, 3.678) ; 
\draw [->] (-.25, 3.687) -- (-2, 5) coordinate (b); 
\draw (2,2) circle (3cm);
\draw[dashed] (2,2) ellipse (3cm and 1cm);
\draw pic [
     shorten >=2mm,
     shorten <=2mm,
     draw,
     latex-,
     angle radius=1.7cm,
     angle eccentricity=1.1,
     "$\rho$"] {angle=a--O--b};


\clip (-1.1,2) rectangle (5.1 cm, 0.9 cm);
\draw (2,2) ellipse (3cm and 1cm); 
\end{tikzpicture}
\end{center}
\end{document}

答案2

PSTricks 解决方案:

\documentclass{article}

\usepackage{pstricks}

\begin{document}

\begin{pspicture}(-2.5,-2)(2.5,3.4)
  \pscircle(0,0){2}
  \psellipticarc(0,0)(2,1){180}{0}
 {\psset{linestyle = dashed}
  \psellipticarc(0,0)(2,1){0}{180}
  \psline(!2 2 sqrt div neg  2 2 sqrt div)(0,0)%
         (!2 2 sqrt div      2 2 sqrt div)}
  \psline{->}(!2 2 sqrt div neg  2 2 sqrt div)(-2.5,2.5)
  \psline{->}(!2 2 sqrt div      2 2 sqrt div)( 2.5,2.5)
  \psline(-0.2,0.2)(0,0.4)(0.2,0.2)
  \psarc{<-}(0,0){3}{50}{130}
  \uput[90](0,3){$\rho$}
\end{pspicture}

\end{document}

输出

相关内容