Julia 3D曲面图(如Matlab),对数刻度中的颜色图

时间:2020-08-15 16:26:27

标签: matlab matplotlib 3d julia surface

我正在尝试绘制如下图所示的3D表面图(来源:Wikipedia):

enter image description here

这是我在julia中的尝试;

x  = [-2:0.05:2;]
y = [-1:0.05:3;]
z = (1 .-x').^2 .+ 100 .*(y.-x'.^2).^2

minZ = minimum(z[:]);  
maxZ = maximum(z[:]);

c =  minZ .+ (maxZ-minZ).*log.(1 .+z .- minZ) ./ log(1+maxZ-minZ)
Plots.plot(x,y,z,st=:surface,color=cgrad(:jet,c),
xlabel = "x",ylabel="y",zlabel="f(x,y)")

enter image description here

这是我的问题:

  1. 即使对数刻度不起作用,我如何也可以使julia绘图颜色图看起来像Matlab。
  2. Matlab图方位角和高程的视图(相机)为(-30,30),而茱莉亚图相机选项根本不起作用。camera = (-30,30)。负值似乎在camera选项中不起作用。如何使视图(x和y选项)看起来类似于matlab。

有关Matlab代码的参考,

clear all;
close all;
hfig = figure(1);

s = 0.05;
X = [-2 : s : 2+s];
Y = [-1 : s : 3+s];
[X, Y] = meshgrid(X, Y);
Z = (1-X).^2 + 100*(Y-X.^2).^2;

% Use log scale of Z for a batter usage of the color spectrum  
minZ = min(Z(:));  
maxZ = max(Z(:));
C = minZ + (maxZ-minZ).*log(1+Z-minZ)./log(1+maxZ-minZ); 


colormap(jet);
surf(X, Y, Z, C, 'EdgeColor', 'none', 'LineStyle', 'none');
 
axis([-2, 2, -1, 3, 0, 2500]);
xlabel('x', 'fontsize', 18);
ylabel('y', 'fontsize', 18);
zlabel('f', 'fontsize', 18);

谢谢

1 个答案:

答案 0 :(得分:1)

也许这会有用吗?

docker exec -it <container-name> gem which exception_notification

enter image description here