0
$\begingroup$
h = 2; k = 8; p = 10;
g1 = ContourPlot[{(x - h)^1.27 + (y - k)^3.75 == 1}, {x, 0, p}, {y, 0,
     p}, ContourStyle -> Red];
g2 = ContourPlot[{(x - h)^1.27 + (y - k)^3.75 == 1}, {y, 0, p}, {x, 0,
     p}, ContourStyle -> Blue] ;
g3 = Plot3D[{(x - h)^1.27 + (y - k)^3.75}, {x, 0, p}, {y, 0, p}, 
   PlotStyle -> Red];
g4 = Plot3D[{(x - h)^1.27 + (y - k)^3.75}, {y, 0, p}, {x, 0, p}, 
   PlotStyle -> Blue] ;
Show[{g1, g2}]
Show[{g3, g4}]

Same function but order of domain interval interchangeably mentioning seems to result in a different (inverse) function..

EDIT1:

Actually the import of my question is for generalization: $(x-y) $ domain interval plot order reversal supplies a means to visualize 2D/3D Contour and Monge inverse function plots .. Is it correct?

$\endgroup$

closed as off-topic by Bob Hanlon, m_goldberg, Alex Trounev, MarcoB, bbgodfrey May 24 at 0:05

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Bob Hanlon, m_goldberg, Alex Trounev, MarcoB, bbgodfrey
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ This is the expected behaviour. You've switched the x and y axes, so the blue line should be a reflection of the red line about the line y = x. Whatever variable comes first is plotted along the x-axis in the contour plot, and the second variable is plotted along the y-axis. $\endgroup$ – MassDefect May 17 at 6:32
  • $\begingroup$ In Plot3D also it is expected to be same function but differently depicted? $\endgroup$ – Narasimham May 17 at 6:51
  • $\begingroup$ Yes, Plot3D will also do the same. Try Show[Plot3D[Exp[a] Sin[b], {a, 0, 5}, {b, 0, 5}], Plot3D[Exp[a] Sin[b], {b, 0, 5}, {a, 0, 5}]] and you'll see that there is a seam where the two plots are reflected about the line a = b. $\endgroup$ – MassDefect May 17 at 19:11
0
$\begingroup$

It's normal for Mathematica to take the first variable as the "x" axis, and the second variable as they "y" axis for for DensityPlot, ContourPlot, Plot3D, and possibly others as well. We don't technically have to label the variables as "x" and "y", we could just as easily use "a" and "b", so MMA just takes them in the order we specify them.

Switching the order of the variables will result in the function being mirrored across the line y = x (or a = b or whatever variables we're using).

This is most easily seen with Plot3D:

Show[
  Plot3D[
     Exp[a] Sin[b], 
     {a, 0, 5}, 
     {b, 0, 5}
  ], 
  Plot3D[
     {None, Exp[a] Sin[b]}, 
     {b, 0, 5}, 
     {a, 0, 5}
  ]
]

Mirroring Plot3D about the line y = x.

$\endgroup$
  • $\begingroup$ Actually the import of my question is for generalization: domain interval plot order reversal supplies a means to visualize 2D/3D Contour and Monge inverse function plots .. Is it correct? $\endgroup$ – Narasimham May 18 at 7:33
  • $\begingroup$ @Narasimham I'm not sure what a Monge inverse function is, but in general I would say you can plot the inverse with this method. Of course, you can also do something like ContourPlot[Evaluate[y == x^2 /. {x -> y, y -> x}], {x, 0, 5}, {y, 0, 5} ] and switch x and y directly. They amount to the same thing as switching the domains. $\endgroup$ – MassDefect May 20 at 3:26
  • $\begingroup$ Monge form is z= f(x,y) now stands apart from z= f(y,x) as you pictured above. $\endgroup$ – Narasimham May 20 at 9:25

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