问题描述
我正在尝试绘制如下图所示的3D表面图(来源:Wikipedia):
这是我在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)")
这是我的问题:
- 即使对数刻度不起作用,我如何也可以使julia绘图颜色图看起来像Matlab。
- 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,2500]);
xlabel('x','fontsize',18);
ylabel('y',18);
zlabel('f',18);
谢谢