16

I've been searching around and digging through the pgfplots manual and I can't quite seem to find a good answer for this. I'm trying to make a graph with "open circles" to indicate where the function is undefined. Right now I'm using the following:

\begin{tikzpicture}
\begin{axis}[
    domain=-2:6,
    xtick={-2,...,6},
    ytick={-20,-10,...,40},
    xmajorgrids=true,ymajorgrids=true,
    xlabel={$x$},title={Graph of $y=g(x)$}
]
\addplot+[mark=none]{(20/9)*(x^3/3-(3/2)*x^2)};
\addplot+[only marks,mark=o,mark options={scale=2},text mark as node=true] coordinates {
    (-2,-20)
    (6,40)
    (5,10)
};
\end{axis}
\end{tikzpicture}

This results in the following picture:

enter image description here

Is there a simple way to fill in those circles so we don't see the graph behind them? I've tried adding "fill=white", "fill opacity=0", etc to the "mark options", but to no avail. I've also tried using the tikz command \draw to manually draw a circle, but that didn't seem to work either.

Thanks!

22

mark=o is an unfilled circle. Use mark=* instead:

 \documentclass{standalone}

\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
    domain=-2:6,
    xtick={-2,...,6},
    ytick={-20,-10,...,40},
    xmajorgrids=true,ymajorgrids=true,
    xlabel={$x$},title={Graph of $y=g(x)$}
]
\addplot+[mark=none]{(20/9)*(x^3/3-(3/2)*x^2)};
\addplot+[only marks,mark=*,mark options={scale=2, fill=white},text mark as node=true] coordinates {
    (-2,-20)
    (6,40)
    (5,10)
};
\end{axis}
\end{tikzpicture}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.