Closed samializzi closed 7 years ago
Does it work in Python? If not, this is a limitation of Matplotlib.
Thanks! You're correct, it doesn't seem to work in python either.
Actually, there is some discussion of doing this in Matplotlib, hence in PyPlot, see here: https://stackoverflow.com/questions/3909794/plotting-mplot3d-axes3d-xyz-surface-plot-with-log-scale .... correction, I misread stackoverflow, the discussion says it is not supported.
So, if/when Matplotlib supports it, something like the following code should work in Julia (note that xscale
etcetera are already exported, no need to use plt.xscale
etcetera):
using PyPlot
x = logspace(-3,2,30)
y = logspace(-2,1,30)
surf(x', y, x' .* y.^3)
title("surface plot")
xscale("log")
yscale("log")
However it fails (giving a blank plot in the GUI, or an error in Jupyter/IJulia). The analogous thing fails in Python, too, so it may be a bug in is a limitation of Matplotlib: matplotlib/matplotlib#9545
Hi,
I couldn't seem to get the log-scale working with PyPlot.plot_surface
Code: pygui(true) plt.figure("Surface plot", figsize=(6,6)) plt.plot_surface(tau1, tau2, q, rstride=2, edgecolors="k", cstride=2, cmap=ColorMap("gray"), alpha=0.8, linewidth=0.25) plt.title("Surface plot"); plt.xscale("log") plt.yscale("log")
tau1,tau2,q are arrays with positive non-zero elements. I exported the arrays into MatLab and it worked fine and it also plotted fine in Julia with log->symlog. I also tried adding xscale = :log10, yscale = :log10 to the arguments of plot_surface to no avail.