How i can get the best option plot for density and also other graph ?
이전 댓글 표시
i saw a lot design of graph which color are change and make a plot very better and really i am looking for such option but i can't manage the option and i don't know which option is good can any one help me for get the best design of plotting?

% Define the grid
[x, y] = meshgrid(linspace(-10, 10, 400), linspace(-10, 10, 400));
% Define the function
Z = real(0.3e1 ./ 0.2e1 * (0.9375e1 .* exp(0.25e1 * x - 0.4761904763e0 * y) + 0.50625e1 .* exp(0.15e1 * x - 0.2e1 * y)) ./ (0.1e1 + 0.15e1 .* exp(0.25e1 * x - 0.4761904763e0 * y) + 0.225e1 .* exp(0.15e1 * x - 0.2e1 * y)) - 0.3e1 ./ 0.2e1 .* (0.375e1 .* exp(0.25e1 * x - 0.4761904763e0 * y) + 0.3375e1 .* exp(0.15e1 * x - 0.2e1 * y)) .^ 2 ./ (0.1e1 + 0.15e1 .* exp(0.25e1 * x - 0.4761904763e0 * y) + 0.225e1 .* exp(0.15e1 * x - 0.2e1 * y)) .^ 2);
% Create density plot
figure;
contourf(x, y, Z, 50, 'LineStyle', 'none');
colormap(prism);
xlabel('x');
ylabel('y');
title('Density Plot of Given Function');
댓글 수: 5
Don't you like the standard colormap ?
% Define the grid
[x, y] = meshgrid(linspace(-10, 10, 400), linspace(-10, 10, 400));
% Define the function
Z = 0.3e1 ./ 0.2e1 * (0.9375e1 .* exp(0.25e1 * x - 0.4761904763e0 * y) + ...
0.50625e1 .* exp(0.15e1 * x - 0.2e1 * y)) ./ (0.1e1 + 0.15e1 .* ...
exp(0.25e1 * x - 0.4761904763e0 * y) + 0.225e1 .* exp(0.15e1 * x - 0.2e1 * y)) - ...
0.3e1 ./ 0.2e1 .* (0.375e1 .* exp(0.25e1 * x - 0.4761904763e0 * y) + ...
0.3375e1 .* exp(0.15e1 * x - 0.2e1 * y)) .^ 2 ./ ...
(0.1e1 + 0.15e1 .* exp(0.25e1 * x - 0.4761904763e0 * y) + ...
0.225e1 .* exp(0.15e1 * x - 0.2e1 * y)) .^ 2;
% Create density plot
figure;
contourf(x, y, Z, 50, 'LineStyle', 'none');
xlabel('x');
ylabel('y');
title('Density Plot of Given Function');
colorbar
salim
2025년 1월 25일
Image Analyst
2025년 1월 25일
@salim saeed doing it like you did shows you the internal high frequency oscillations but at the expense of not knowing what the intensity is. So you can see localized structure but not overall intensity like @Torsten's code shows. However using colormaps can often be deceptive because they can create visual boundaries between the colors that don't represent the actual values themselves. The more the colormap varies, the worse that effect is. That's why I often simply use a grayscale representation which I think gives me a better overall impression of the intensity at different areas.
So I'm not really sure what you want. If you want to visualize slight local variations, then your code already does that, though at the expense of knowing the actual global intensities.
salim
2025년 1월 25일
Walter Roberson
2025년 1월 25일
The best option plot is due to be invented by small furry creatures from Alpha Centori in only 4,107,932 years. The methods available in this current century on Earth are only the 29th best way.
답변 (1개)
Sreejith Thazhathe Veetil
2025년 1월 25일
1 개 추천
figure;
contourf(x, y, Z, 200, 'LineStyle', 'none');
colormap("colorcube");
xlabel('x');
ylabel('y');
title('Density Plot of Given Function');

Other option
% Plot the 3D surface to observe the doubly spread waveform
surf(X, Y, Z, 'EdgeColor', 'none');

카테고리
도움말 센터 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

