Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Say I have a density plot such as

DensityPlot[Sin[x]*Sin[y],{x,-2,2},{y,-2,2}]

Is there a way to see a projection of this plot. For example is there a way to see a plot of the maximum values from x=-2 to x=2? Or perhaps the values from x=-2 to x=2 along the line y=0? Maybe a way to get the numerical values and plot it?

Thanks!

P.S. I am looking to do this from the plot, not setting y=0 and solving mathematically.

share|improve this question

closed as unclear what you're asking by Kuba, Sjoerd C. de Vries, bobthechemist, rm -rf Jan 14 at 16:34

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

    
What do you mean by "from the plot". Is, in the latter case, Plot[Sin[x]Sin[0],{x,-2,2}] wrong? –  Kuba Jan 14 at 0:30
    
{plot, {data}} = Reap@DensityPlot[Sin[x]*Sin[y], {x, -2, 2}, {y, -2, 2}, EvaluationMonitor :> Sow[{x, y, Sin[x] Sin[y]}]] will store the computed values of the plot in data. But since it only computes values on a discrete set, it's not clear whether you can use it to do what you might have in mind. –  Michael E2 Jan 14 at 14:52

1 Answer 1

As Kuba has show $f(x,y)=\sin (x)\sin (y)$ at $y=0$ is constant and zero. For illustrative purposes the 3D plot for y-0 versus x=y is shown using MeshFunctions:

enter image description here

Code:

Plot3D[Sin[x]*Sin[y], {x, -2, 2}, {y, -2, 2}, 
 MeshFunctions -> {(#2 &), (#1 - #2 &)}, Mesh -> {{0}, {0}}, 
 MeshStyle -> {{Thick, Red}, {Thick, Red}}]
share|improve this answer

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