1

Please consider this MWE:

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\pgfplotsset{soldot/.style={color=black,only marks,mark=*}}
\pgfplotsset{holdot/.style={color=red,fill=white,very thick,only marks,mark=*}}

\begin{document}

\begin{center}                                                          
\begin{tikzpicture}
        \begin{axis}[
            legend pos=outer north east,
            axis lines = center,
            label style={font=\tiny},
            legend style={font=\tiny},
            xticklabel style = {font=\tiny},
            yticklabel style = {font=\tiny},
            xlabel = $x$,
            ylabel = $y$,
            clip=false,
            legend style={cells={align=left}}
        ]
        \addplot[red,thick] {x*x*x-y*y-y};
    \end{axis}
\end{tikzpicture}
\end{center}

\end{document}

Original graph

Overleaf throws me the following error:

! Package pgfplots Error: Sorry, you can't use 'y' in this context. PGFPlots expected to sample a line, not a mesh. Please use the [mesh] option combined with [samples y>0] and [domain y!=0:0] to indicate a twodimensional input domain.

so I change

\addplot[red,thick] {x*x*x-y*y-y};

for

\addplot[samples y>0, domain y!=0:0,red,thick] {x*x*x-y*y-y};

but now 4 errors appears, and when using addlegendentry the picture is Mesh picture instead of the normal line.

I would like to graph the implicit function like this:

What I want

not using gnuplot. Is that possible?

Thanks!

4

You wish to plot x^3-y^2-y=0, which is equivalent to x^3=y^2+y or x=sign(y^2+y)\cdot|y^2+y|^{1/3}.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture} 
\begin{axis}[axis lines=middle,xlabel=$x$,ylabel=$y$,title=lul]
    \addplot[red,domain=-1.1:0.6,samples=101] 
    ({sign(x*x+x)*pow(abs(x*x+x),1/3)},x);
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

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.