# Rotating DensityPlot

I have a DensityPlot of Tan[x - y] as follows.

I want to set different View Point. (As I know ViewPoint is not active in DensityPlot)

When I rotate the DensityPlot, frame labels, plot legends, and axis also rotate. How to set correct frame labels, plot legends, and axis numbers?

    plot = DensityPlot[Tan[x - y], {x, 0, 2}, {y, 0, 5},
Mesh -> Automatic, MeshFunctions -> {#3 &}, FrameLabel -> {x, y}, PlotLegends -> Automatic];
Rotate[plot, Pi/2]


I want to get a figure as follows: (But, on the x-axis, the large values can be at the top and small values at the bottom.)

• did you try the replace of x and y in {x,0,5},{y,0,5}? Jun 21, 2021 at 10:49
• It is not clear to me what you are trying to achieve. Can you make a mock-up example to illustrate it? (Show a picture that approximated the result you want.) Do you want the frame rotated? Do you want the contents rotated (that's a coordinate transofrmation)? Jun 21, 2021 at 11:45
• I edited my post according to your suggestion @Szabolcs Jun 21, 2021 at 12:09
• I would call this exchanging the x and y axes, not rotation. When I read "rotation", I though you want to rotate by an arbitrary amount. Jun 21, 2021 at 12:10
• There were prior questions on this, see e.g. mathematica.stackexchange.com/q/18655/12 You can simply exchange the x and y variables in your formula and label the axes accordingly. Or do you also want to invert the x axis, so large values are at the bottom and small values at the top? Jun 21, 2021 at 12:11

Just to explore some of the range of possibilities from @Lukas_Lang's comment:

plot = DensityPlot[Tan[x - y], {x, 0, 2}, {y, 0, 5},
Mesh -> Automatic, MeshFunctions -> {#3 &}, FrameLabel -> {x, y},
PlotLegends -> Automatic, ImageSize -> 250,
ScalingFunctions -> #] & /@ {
{None, None, None},
{"Reverse", None, None},
{"Reverse", "Reverse", None},
{"Reverse", "Reverse", "Reverse"},
{"Reverse", None, "Reverse"}
}


This preserves the OP's original x & y values/ranges. Not certain if it gives them what they need.