0

I want to plot all possible solutions for sqrt(|x||y|) = 2 into my plot as a line. My code for the plot currently looks like this

\documentclass{article}

\usepackage{pgfplots}
\pgfplotsset{compat = newest}
\usepackage{tikz}

\begin{document}
    \begin{tikzpicture}
        
        \begin{axis}[ view={20}{45}]
            
            \addplot3 [
            domain=0:10,
            domain y = 0:10,
            samples = 30,
            %samples y = 80,
            mesh] {sqrt(abs(x) * abs(y))};
            
        \end{axis}
        
    \end{tikzpicture}
    
\end{document}

For the 3D plot, which looks like this

Plot result

How do I highlight all coordinates, which fulfill the equation? Moreover, is it possible to remove the little offset in z direction so that the graph is staying directly on the ground?

2
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. Jun 18 at 20:24
  • thank you! I hope its better now
    – 1somorph
    Jun 18 at 20:28

1 Answer 1

1
\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[view={10}{45}, zmin=0]
\addplot3 [
domain=0:10,
domain y=0:10,
samples=30,
mesh] {sqrt(abs(x) * abs(y))};
\addplot3[thick, domain=0:10, samples y=1, smooth] (x, {4/x}, 2);
\end{axis}
\end{tikzpicture}
\end{document}

Surface and path plot

1
  • This is exactly what I was looking for! Thank you so much!
    – 1somorph
    Jun 18 at 20:45

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.