Is it possible somehow to generalize the symlog function proposed here 'symlog'-like Plot with a mixed log-linear-log scale to a 3D plot, as ListPointPlot3D
or Plot3D
, so that it would be possible to use it in ScalinFunction
as: ScalingFunctions -> {"Log", None, "symlog"}
or maybe as ScalingFunctions -> {"Log", None, Function[z, Sign[z] (Exp[Abs[z]] - 1)]}
to plot negative data points. I would like to have the possibility to choose one axis in log scale, one in normal scale and another using this symlog option, for example. Also because my version does not seem to have the embeded scaling function SignedLog
.
1 Answer
ScalingFunctions
seem to require a function and its inverse to work. Therefore you need one of these two:
symlog = {Function[x, Sign[x]*Log[Abs[x] + 1]],
Function[y, Sign[y]*(Exp[Abs[y]] - 1)]};
(* Same functionality as "SignedLog" *)
symlog10 = {Function[x, Sign[x]*(Log10[Abs[x] + 1])],
Function[y, Sign[y]*(10^Abs[y] - 1)]};
Then you can use exactly what you suggested:
Plot3D[x^3 y^2, {x, -3, 3}, {y, -3, 3},
ScalingFunctions -> {None, None, symlog}, BoxRatios -> {1, 1, 1}]
-
$\begingroup$ However, this seems to distort the data. For example if you do:
data={{1, 5}, {2, 4}, {3, 3}, {4, 2}, {5, 0}, {6, -2}, {7, -8}, {8, -14}, {9, -22}, {10, -30}}
andListPlot[data + 40, Frame -> True, ScalingFunctions -> {None, "Log"}]
orListPlot[data, Frame -> True, ScalingFunctions -> {None, symlog}]
you get two different plots. $\endgroup$ Apr 13, 2022 at 9:27 -
1$\begingroup$ Why would you expect them to be the same? Note that adding
data + 40
, adds it to everything, both x and y. Secondly, if you think about what is happening, since you are using a log axis, you are essentially usinglog(y)
, and note thatlog(f(x)+40)
is not the same as shifting the data, i.e.log(f(x))+c
. Thirdly, SignedLog is actually defined assign(y)*log(|y|+1)
, so you can't just compare it directly with the log scale - for large values of y they will look the similar, but for smaller they will not. $\endgroup$– mszyniszApr 15, 2022 at 0:43