\filldraw를 사용하면 그래프가 사라집니다.

\filldraw를 사용하면 그래프가 사라집니다.

포물선을 그리고 있어요. LaTeX 코드는 잘 작동합니다. 그런데 코드에 점을 찍고 싶을 때

\filldraw (A) circle (1pt) node[above right] {A}; 

그러면 그래프가 사라집니다. 코드는

\documentclass{article}

\usepackage{tikz}

\begin{document}

    \begin{tikzpicture}
        \def\a{1}
        \def\c{1}
        \def\xo{1}

        \def\xA{-7}
        \def\xB{2}
        \def\xC{7.5}

        \draw[domain=-2:4,smooth,variable=\x,blue] plot ({\x},{\a*(\x-\xo)*(\x-\xo) + \c});

        \pgfmathsetmacro{\yA}{\a*(\xA-\xo)*(\xA-\xo)+\c};
        \coordinate (A) at (\xA,\yA);

        \filldraw (A) circle (1pt) node[above right] {A};

        \draw[->] (-2,0) -- (8,0) node[right] {$x$};
        \draw[->] (0,-1) -- (0,4) node[above] {$y$};
    \end{tikzpicture}

\end{document}

감사합니다.

답변1

(-7/65)그래프에서 몇 마일 떨어진 지점을 추가하려고 하여 전체 이미지가 페이지에 맞지 않을 정도로 커졌습니다.

대신 그래프 내의 점을 사용하면 코드가 제대로 작동합니다.

\documentclass{article} 

\usepackage{tikz}

\begin{document}
    
    \begin{tikzpicture}  
        
        \def\a{1}
        \def\c{1}
        \def\xo{1}
        
        \def\xA{0} 
        \def\xB{2}
        \def\xC{7.5} 
        
        \draw[domain=-2:4,smooth,variable=\x,blue] plot ({\x},{\a*(\x-\xo)*(\x-\xo) + \c}); 
        
        \pgfmathsetmacro{\yA}{\a*(\xA-\xo)*(\xA-\xo)+\c}; 
        \coordinate (A) at (\xA,\yA);  
        
        \filldraw (A) circle (1pt) node[above right] {A}; 
    
        \draw[->] (-2,0) -- (8,0) node[right] {$x$};
        \draw[->] (0,-1) -- (0,4) node[above] {$y$};
    \end{tikzpicture} 
    
\end{document}

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

관련 정보