4
$\begingroup$

I want to compare same plot with mathematica and python but they use different order of axes. I tried to change them in Plot3D such that they look like the following plot in python: enter image description here but lot of tricks did not work. Namely I tried AxesEdge, AxesOrigin, ViewPoint, $\ldots$ etc.

Is there any simple way to do this avoiding dynamic and rotation ?

I'm using the following code

domain = {0, 1};
Plot3D[Exp[x y], {x, 0, 1}, {y, ##}, ColorFunction -> "Rainbow",
PlotLegends -> Automatic, AxesLabel -> {"x", "y"}] & @@ domain

It gives the following: enter image description here

$\endgroup$
6
  • $\begingroup$ Does Graphics3D[{}, Axes -> True, AxesLabel -> {"x", "y", "z"}, FaceGrids -> {{1, 0, 0}, {0, 1, 0}, {0, 0, -1}}, PlotRange -> ConstantArray[{0, 1}, 3], ViewPoint -> {-2.4, -2.4, 2.}] look like what you need? $\endgroup$ Commented Sep 21, 2020 at 11:54
  • $\begingroup$ Thanks for your reply, I'm using Plot3D and z-axis is in the right side linked to x-axis as in the image. $\endgroup$
    – Migalobe
    Commented Sep 21, 2020 at 12:06
  • $\begingroup$ Copy the AxesLabel -> {"x", "y", "z"}, FaceGrids -> {{1, 0, 0}, {0, 1, 0}, {0, 0, -1}}, and ViewPoint -> {-2.4, -2.4, 2.} into your Plot3D[] and see if it helps. $\endgroup$ Commented Sep 21, 2020 at 12:09
  • $\begingroup$ It gives x and y with same origin and z on the left hand side. I got the same result with AxesEdge. In my case, x and z are with same origin and y start at the end of x-axis. $\endgroup$
    – Migalobe
    Commented Sep 21, 2020 at 12:18
  • 1
    $\begingroup$ Can you please include the Plot3D[] expression you are having trouble with, then? It's hard to say anything more helpful without seeing something concrete. $\endgroup$ Commented Sep 21, 2020 at 12:22

1 Answer 1

4
$\begingroup$

Is this what you need?:

domain = {0, 1};
Plot3D[Exp[x y], {y, ##}, {x, 0, 1}, ColorFunction -> "Rainbow", AxesLabel -> Automatic,
   ScalingFunctions -> {"Reverse", "Reverse"}, AxesEdge -> {Automatic, {1, -1}, {1, 1}},
   PlotTheme -> "Detailed"] & @@ domain

enter image description here

$\endgroup$
6
  • $\begingroup$ Thanks, just x and y are reversed. $\endgroup$
    – Migalobe
    Commented Sep 21, 2020 at 12:56
  • 1
    $\begingroup$ @Migalobe That's easy to modify, see my update. $\endgroup$
    – xzczd
    Commented Sep 21, 2020 at 13:00
  • $\begingroup$ I think it's like we plot $f(y,x)$ instead of $f(x,y)$. They are not the same if the function is not symmetric, right ? $\endgroup$
    – Migalobe
    Commented Sep 21, 2020 at 13:10
  • 1
    $\begingroup$ @Migalobe No, I'm just changing the order of axis. Remember that 2nd argument of Plot3D is the range for 1st axis (usually denoted as $x$ axis in traditional math. ) $\endgroup$
    – xzczd
    Commented Sep 21, 2020 at 13:17
  • 2
    $\begingroup$ @Migalobe Of course, 110 is so large compared to the maximum of Exp[x y] in the plotted domain. $\endgroup$
    – xzczd
    Commented Sep 21, 2020 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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