0

I want to draw the region bounded by y=x^2 and y=x. Any ideas? I was hoping this would be somewhat simple. I've tried used a similar, with \begin{axis}..\end{axis}, but it doesn't like that. Did I not declare a package or something?

Also, if I wanted to show the solid this region creates by rotating it about the x-axis, is there a way to did this in latex? (If you had cal 2, think volume of a solid rotated about ...).

4
  • 2
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – Null
    Commented May 19, 2015 at 20:48
  • Plotting a 2D region is relatively easy. But doing 3D requires a different package. :)
    – Alenanno
    Commented May 19, 2015 at 20:49
  • Is this what you had in mind?
    – Alenanno
    Commented May 19, 2015 at 21:02
  • @Alenanno yes, but only want the first quadrate, thank you Commented May 19, 2015 at 21:07

1 Answer 1

3

Like I said in the comments, plotting a function in 2D is relatively easy in pgfplots, and with the version 1.10 filling between is even easier.

Output

enter image description here

Code

\documentclass{article}
\usepackage{pgfplots}

\pgfplotsset{compat=1.10}
\usepgfplotslibrary{fillbetween}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
    xmin=0, xmax=10,
    ymin=0, ymax=10
    ]

    \addplot [name path=plot1, ultra thin, domain=-10:10, samples=150]{x^2};
    \addplot [name path=plot2, ultra thin, domain=-8:8]{x};

    \addplot[red] fill between[of=plot1 and plot2, soft clip={domain=0:1}];

\end{axis}
\end{tikzpicture}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .