轴和隐式图的问题:Shift 输入轴的绘制和隐式函数

轴和隐式图的问题:Shift 输入轴的绘制和隐式函数

观察这个 LaTeX 示例:我使用环境绘制了gnuplot一条隐式曲线(圆锥曲线)、一条水平线和一条垂直线(通过原点的轴)。我不明白结果:隐式函数和直线不在网格上居中!我不知道如何解决这个问题。谁能帮帮我?

以下是整个文件:

\documentclass[11pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{gnuplottex}
\usepackage[francais]{babel}

%\usepackage{tikz, pgfplots}   

\usepackage{geometry}
\geometry{top=2cm, bottom=2cm, left=2cm, right=2cm}
% ------------------------------------------
\begin{document}

\begin{center}
\begin{gnuplot}[ scale=1.5]
# paramètres
    phi = (38)*pi/180
    g = 2
    D = (0)*pi/180
    I = pi/2
    delta = 23.44*pi/180
# coefficients de la conique f(x,y)=0
    A = sin(delta)**2-cos(phi)**2*sin(D)**2
    B = sin(2*phi)*sin(D)*sin(I)+cos(phi)**2*sin(2*D)*cos(I)
    C = sin(delta)**2-(sin(phi)*sin(I)+cos(phi)*cos(D)*cos(I))**2
    D = g*(cos(phi)**2*sin(2*D)*sin(I)-sin(2*phi)*sin(D)*cos(I))
    E = g*(sin(2*phi)*cos(D)*cos(2*I)+sin(2*I)*(sin(phi)**2-cos(phi)**2*cos(D)**2))
    F = g**2*( sin(delta)**2-sin(phi)**2*cos(I)**2-cos(phi)**2*cos(D)**2*sin(I)**2+1/2*sin(2*phi)*cos(D)*sin(2*I))
# déclaration de la fonction implicite
    f(x,y)=A*x**2+B*x*y+C*y**2+D*x+E*y+F
# quelques reglages
    set cntrparam levels discrete 1.0
    set isosamples 1500,1500
    set xrange [-10:10]
    set yrange [-10:10]
    set title '$ax^2+bxy+cy^2+dx+ey+f=0$'
    set ylabel '$y$'
    set xlabel '$x$'
    set size ratio 1
    set nogrid
    # show size
    show offsets
    set view 0,0
    set cntrparam bspline
    set contour base
    unset surface
    set table 'implicite.dat'
    splot f(x,y), x, y
    unset table
# représentation graphique de la fonction implicite
    plot 'implicite.dat'  notitle w l
\end{gnuplot}
\end{center}
\end{document}

答案1

使用命令

set cntrparam levels discrete 1.0

您在 处选择一条轮廓线z=1,因此水平线和垂直线在 处相交(1,1)。使用set cntrparam levels discrete 0.0应该会得到预期的结果。这是一个有效的 gnuplot 脚本。该行为与 完全无关gnuplottex

phi = (38)*pi/180
g = 2
D = (0)*pi/180
I = pi/2
delta = 23.44*pi/180
# coefficients de la conique f(x,y)=0
A = sin(delta)**2-cos(phi)**2*sin(D)**2
B = sin(2*phi)*sin(D)*sin(I)+cos(phi)**2*sin(2*D)*cos(I)
C = sin(delta)**2-(sin(phi)*sin(I)+cos(phi)*cos(D)*cos(I))**2
D = g*(cos(phi)**2*sin(2*D)*sin(I)-sin(2*phi)*sin(D)*cos(I))
E = g*(sin(2*phi)*cos(D)*cos(2*I)+sin(2*I)*(sin(phi)**2-cos(phi)**2*cos(D)**2))
F = g**2*( sin(delta)**2-sin(phi)**2*cos(I)**2-cos(phi)**2*cos(D)**2*sin(I)**2+1/2*sin(2*phi)*cos(D)*sin(2*I))
# déclaration de la fonction implicite
f(x,y)=A*x**2+B*x*y+C*y**2+D*x+E*y+F
# quelques reglages
set cntrparam levels discrete 0.0
set isosamples 1500,1500
set xrange [-10:10]
set yrange [-10:10]
set size ratio 1
set cntrparam bspline
set contour base
unset surface
set table 'implicite.dat'
splot f(x,y), x, y
unset table
# représentation graphique de la fonction implicite
plot 'implicite.dat'  notitle w l

使用 gnuplot 4.6.5 的结果如下:

在此处输入图片描述

答案2

这是使用 PSTricks 的解决方案。使用latex->dvips->ps2pdf或使用xelatex

\documentclass[pstricks,border=0bp,12pt,dvipsnames]{standalone}
\usepackage{pst-func}
\begin{document}

\psset{unit=0.6}
\begin{pspicture*}(-10.5,-10.5)(10.5,10.5)
  \psaxes[Dx=2,Dy=2]{->}(0,0)(-10,-10)(10,10)
  \psplotImp[algebraic,linecolor=red,linewidth=1.5pt](-11,-11)(11,11)[
      /phi 38 DegtoRad def
    /g 2 def
    /D 0 RadtoDeg def
    /I PI 2 div def
    /delta 23.44 DegtoRad def
    ]{%
    (sin(delta)^2-cos(phi)^2*sin(D)^2)*x^2
   +(sin(2*phi)*sin(D)*sin(I)+cos(phi)^2*sin(2*D)*cos(I))*x*y
   +(sin(delta)^2-(sin(phi)*sin(I)+cos(phi)*cos(D)*cos(I))^2)*y^2
   +(g*(cos(phi)^2*sin(2*D)*sin(I)-sin(2*phi)*sin(D)*cos(I)))*x
   +(g*(sin(2*phi)*cos(D)*cos(2*I)+sin(2*I)*(sin(phi)^2-cos(phi)^2*cos(D)^2)))*y
   +g^2*( sin(delta)^2-sin(phi)^2*cos(I)^2-cos(phi)^2*cos(D)^2*sin(I)^2
       +1/2*sin(2*phi)*cos(D)*sin(2*I))}
\end{pspicture*}

\end{document}

在此处输入图片描述

相关内容