如何使距离看起来相等?

如何使距离看起来相等?

我试图证明抛物线的任何一点到焦点和准线的距离都相同。但在我的图中它们似乎不相等。

\documentclass{article}
\usepackage{tikz,amsmath, amssymb,bm,color,pgfplots}
\usepackage{tkz-euclide,newtxmath}
\usetikzlibrary{shapes,arrows}
\usetkzobj{all}
\usetikzlibrary{calc}
 \pgfkeys{/pgfplots/axis_style/.style={axis lines=center,
 xlabel style={at={(current axis.right of origin)},xshift=1.5ex, anchor=center},
ylabel style={at={(current axis.above origin)},yshift=1.5ex, anchor=center}}}
\pgfkeys{/pgfplots/arrow_style/.style={tick label style={font=\scriptsize},axis line style={-latex}}}
\begin{document}
\begin{tikzpicture}
\begin{axis}[xmin=-2.2,xmax=2.4,ymin=-1.5,ymax=4,x=1cm,y=1cm,
ticks=none,xlabel={\footnotesize $ x $},ylabel={\footnotesize $ y $},
axis_style,arrow_style]
\addplot [domain=-1.8:1.8] {x^2};
\addplot [domain=-2:2] {-0.5};
\end{axis}
\node at (1.9,1.2) {$O$};
\node (E) at (2.2,2) {};
\tkzLabelPoint[left](E){$E\left(0,\frac{p}{2}\right)$}
\node (M) at (1.2+2.2,1.44+1.5){};
\node (P) at (1.2+2.2,1){};
\draw (2.2,2)--(3.4,2.95)--(3.4,1);
\tkzLabelPoint[right](M){$M(x,y)$}
\tkzDrawPoints(E,M)
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

不同的线长来自 x 轴和 y 轴的不同单位。以下选项可提供axis帮助:

scale only axis,
unit vector ratio={1 1},

为了便于说明,以下示例还添加了刻度。焦点设置在 (0, 0.25),点 M 位于 x=1.2。

\documentclass{article}
\usepackage{tikz,color,pgfplots}
\usepackage{tkz-euclide,newtxmath}
\usetikzlibrary{shapes,arrows}
\usetkzobj{all}
\usetikzlibrary{calc}
\pgfkeys{
  /pgfplots/axis_style/.style={
    axis lines=center,
    xlabel style={
      at={(current axis.right of origin)},
      xshift=1.5ex,
      anchor=center,
    },
    ylabel style={
      at={(current axis.above origin)},
      yshift=1.5ex,
      anchor=center,
    },
    label style={node font=\footnotesize},
  },
}
\pgfkeys{
  /pgfplots/arrow_style/.style={
    tick label style={font=\scriptsize},
    axis line style={-latex},
  },
}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[
    xmin=-2.2,
    xmax=2.4,
    ymin=-1.5,
    ymax=4,
    x=1cm,
    y=1cm,
    % ticks=none,
    xlabel={$ x $},
    ylabel={$ y $},
    axis_style,arrow_style,
    scale only axis,
    unit vector ratio={1 1},
  ]
    \addplot [domain=-1.8:1.8] {x^2};
    \addplot [domain=-2:2] {-0.25};
    \coordinate (M) at (axis cs:1.2, 1.44);
    \coordinate (E) at (axis cs:0, .25);
    \coordinate (P) at (axis cs:1.2, -.25);
    \coordinate (O) at (axis cs:0, 0);
    \draw (E) -- (M) -- (P);
    \tkzLabelPoint[above left](E){$E\left(0, \frac{p}{2}\right)$}
    \tkzLabelPoint[right](M){$M(x,y)$}
    \tkzLabelPoint[below](P){$P$}
    \tkzLabelPoint[below left](O){$O$}
  \end{axis}
  \tkzDrawPoints(E,M,O,P)
\end{tikzpicture}
\end{document}

结果

按照 Sigur 的建议,添加圆并平滑抛物线:

\documentclass{article}
\usepackage{tikz,color,pgfplots}
\usepackage{tkz-euclide,newtxmath}
\usetikzlibrary{shapes,arrows}
\usetkzobj{all}
\usetikzlibrary{calc}
\pgfkeys{
  /pgfplots/axis_style/.style={
    axis lines=center,
    xlabel style={
      at={(current axis.right of origin)},
      xshift=1.5ex,
      anchor=center,
    },
    ylabel style={
      at={(current axis.above origin)},
      yshift=1.5ex,
      anchor=center,
    },
    label style={node font=\footnotesize},
  },
}
\pgfkeys{
  /pgfplots/arrow_style/.style={
    tick label style={font=\scriptsize},
    axis line style={-latex},
  },
}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[
    xmin=-2.2,
    xmax=2.4,
    ymin=-1.5,
    ymax=4,
    x=1cm,
    y=1cm,
    % ticks=none,
    xlabel={$ x $},
    ylabel={$ y $},
    axis_style,arrow_style,
    scale only axis,
    unit vector ratio={1 1},
  ]
    \addplot [smooth, domain=-1.8:1.8] {x^2};
    \addplot [domain=-2:2] {-0.25};
    \coordinate (M) at (axis cs:1.2, 1.44);
    \coordinate (E) at (axis cs:0, .25);
    \coordinate (P) at (axis cs:1.2, -.25);
    \coordinate (O) at (axis cs:0, 0);
    \draw (E) -- (M) -- (P);
    \tkzLabelPoint[above left, xshift=-1.2ex]%
      (E){$E\left(0, \frac{p}{2}\right)$}
    \tkzLabelPoint[right](M){$M(x,y)$}
    \tkzLabelPoint[below](P){$P$}
    \tkzLabelPoint[below left](O){$O$}
  \end{axis}
  \tkzDrawCircle[dashed, thin](M,P)
  \tkzDrawPoints(E,M,O,P)
\end{tikzpicture}
\end{document}

结果

答案2

焦点和准线的坐标有误。以下是正确代码:

\documentclass{article}
\usepackage{tikz,amsmath, amssymb,bm,color,pgfplots}
\usepackage{tkz-euclide,newtxmath}
\usetikzlibrary{shapes,arrows}
\usetkzobj{all}
\usetikzlibrary{calc}
\pgfkeys{/pgfplots/axis_style/.style={axis lines=center,
xlabel style={at={(current axis.right of origin)},xshift=1.5ex, anchor=center},
ylabel style={at={(current axis.above origin)},yshift=1.5ex, anchor=center}}}
\pgfkeys{/pgfplots/arrow_style/.style={tick label style={font=\scriptsize},axis line style={-latex}}}

\begin{document}

\begin{tikzpicture}
  \begin{axis}[xmin=-2.2,xmax=2.4,ymin=-1.5,ymax=4,x=1cm,y=1cm,
      ticks=none,xlabel={\footnotesize $ x $},ylabel={\footnotesize $ y $},
    axis_style,arrow_style]
    \addplot [domain=-1.8:1.8] {x^2};
    \addplot [domain=-2:2] {-0.25};
  \end{axis}
  \node at (1.9,1.2) {$O$};
  \node (F) at (2.2,1.75) {};
  \tkzLabelPoint[left](F){$F\left(0,\frac{p}{2}\right)$}
  \node (M) at (1.2+2.2,1.44+1.5){};
  \node (P) at (1.2+2.2,1){};
  \draw (2.2,1.75)--(3.4,2.95)--(3.4,1.25);
  \tkzLabelPoint[right](M){$M(x,y)$}
  \tkzDrawPoints(F,M)
\end{tikzpicture}

\end{document} 

在此处输入图片描述

我添加了代码pstricks

\documentclass[pdf]{standalone}
\usepackage{pst-plot, pst-node}
\usepackage{nccmath}
\usepackage{newtxmath}
\begin{document}

\psset{algebraic, arrowinset=0.2, ticks=none, labels=none, plotstyle=curve, labelsep=3pt, linewidth=0.6pt, dotsize=3pt}
\footnotesize
\begin{pspicture*}(-2.2,-1.5)(2.7,4.4)
    \psaxes[arrows=->, linewidth=0.6pt](0,0)(-2.2,-1.5)(2.4,4)[$x$,0][\footnotesize$y$,90]
    \psplot[linewidth=1pt]{-1.96}{1.96}{x^2}
    \psline(-2.2,-0.25)(2.4,-.25)
    \dotnodes(1.2,1.44){M}(0,0.25){F}
    \pnodes(0,0){O}(1.2,-0.25){H}
    \uput[dl](O){$O$}\uput[r](M){$(M(x, y)$}\uput[l](F){$F(0, \mfrac p2)$}
    \psline(F)(M)(H)
\end{pspicture*}

\end{document} 

在此处输入图片描述

相关内容