동일한 데카르트 평면에서 한 선이 다른 선보다 길게 그려졌습니다.

동일한 데카르트 평면에서 한 선이 다른 선보다 길게 그려졌습니다.

두 선이 서로 다른 길이로 그려지는 이유는 무엇입니까? 기울어진 선은 약간(아마도 2ex 정도) 짧아야 하며 수직선은 길어져서 기울어진 선과 동일한 높이를 얻어야 합니다.

반대편의 기울어진 선에 대한 방정식은 어떻게 구하나요? 이제 그 위치는 곡선 y=(3/2)x + 5/2에 라벨을 붙인 것처럼 보입니다.

x축 위쪽에 그래프를 조금 더 그리려면 코드에서 무엇을 변경해야 하나요? ymax=25대신에 ymax=15?

\documentclass{amsart}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}


\begin{document}



\begin{tikzpicture}
\begin{axis}[width=4in,axis equal image,clip=false,
    axis lines=middle,
    xmin=-15,xmax=15,
    domain=-15:15, samples=101,
    xlabel=$x$,ylabel=$y$,
    ymin=-15,ymax=15,
    restrict y to domain=-20:20,
    enlargelimits={abs=1cm},
    axis line style={latex-latex},
    ticklabel style={font=\tiny,fill=white},
    xtick={\empty},ytick={\empty}
]
\addplot[samples=251,domain=-25:1.5] {(3*x^2+5*x)/(2*x-3)};
\addplot[samples=251,domain=1.5:25] {(3*x^2+5*x)/(2*x-3)} node[above,pos=0.85]{$\scriptstyle{y}=\frac{3x^{2}+5x}{2x-3}$};
\addplot [dashed, latex-latex] {(3/2)*x+5/2} node [pos=0.15, anchor=south, font=\footnotesize, sloped] {$y=\frac{3}{2}x+\frac{5}{2}$};
\addplot [dashed, latex-latex] (1.5,x) node [pos=0.15, anchor=north, font=\footnotesize, sloped] {$x=\frac{3}{2}$};
\end{axis}
\end{tikzpicture}

\end{document}

여기에 이미지 설명을 입력하세요

답변1

\documentclass{amsart}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}


\begin{document}



\begin{tikzpicture}
\begin{axis}[width=4in,axis equal image,clip=false,
    axis lines=middle,
    xmin=-15,xmax=15,
    samples=101,
    xlabel=$x$,ylabel=$y$,
    ymin=-15,ymax=15,
    restrict y to domain=-20:25,
    enlargelimits={abs=1cm},
    axis line style={latex-latex},
    ticklabel style={font=\tiny,fill=white},
    xtick={\empty},ytick={\empty},
]
\addplot[samples=251,domain=-25:1.5] {(3*x^2+5*x)/(2*x-3)};
\addplot[samples=251,domain=1.5:15] {(3*x^2+5*x)/(2*x-3)} node[above right,anchor=south west,pos=0.95]{$\scriptstyle{y}=\frac{3x^{2}+5x}{2x-3}$};
\addplot [dashed, latex-latex,domain=-13:10] {(3/2)*x+5/2} node [pos=0.15, anchor=north, font=\footnotesize, sloped] {$y=\frac{3}{2}x+\frac{5}{2}$};
\addplot [dashed, latex-latex,domain=-17:17.5] (1.5,x) node [pos=0.15, anchor=north, font=\footnotesize, sloped] {$x=\frac{3}{2}$};
\end{axis}
\end{tikzpicture}

\end{document}

여기에 이미지 설명을 입력하세요

몇 가지 설명:

점선 플롯에 적절한 도메인을 추가할 수 있습니다. 기울어진 선의 경우 를 수정한다고 가정해 보겠습니다 ,domain=-13:10. 그런 다음 의 최대값과 최소값은 각각 과 y입니다 . 아니요, 좌표에서 와 같이 수직 점선 에 대한 값을 수정합니다 .17.5-17ydomain=-17:17.5{1.5,x}

기울어진 선에 대해 아래 레이블을 가져오려면 앵커를 로 변경합니다 anchor=north,.

위쪽 곡선을 확장하려면 의 값을 변경해야 합니다 restrict y to domain=-20:25,. 축선 길이를 적절하게 얻으려면 및 값을 적절 ymax하게 변경 xmax하십시오 . (또는 의 값을 변경합니다 ).yminxminabs=1cmenlargelimits

관련 정보