Y-axis is switching to 1.5 to -1.5 instead of -1.5 to 1.5? How do you fix this and modify data to match?

5 ビュー (過去 30 日間)
% Plot the convergence array using the 'imagesc' command
figure;
imagesc(real(lower_left):spacing:real(upper_right), imag(lower_left):spacing:imag(upper_right), convergence_array);
colormap jet;
colorbar;
hold on;
% Plot the three roots as dots
scatter(real(roots_exact), imag(roots_exact), 'k', 'filled');
% Set the axis limits and labels
xlim([-2 2.5]);
ylim([-1.5 1.5]);
set(gca, 'YDir','reverse')
xlabel('Real Part');
ylabel('Imaginary Part');
title('Fractal: Basins of Attraction');
Unrecognized function or variable 'f'.

採用された回答

Steven Lord
Steven Lord 2023 年 10 月 7 日
As written you're calling imagesc in its "high level" variant. See the "More About" section on that documentation page for more information. The reason that's relevant is because one of the axes properties the high-level variant of imagesc sets is "YDir to 'reverse'. Values along the y-axis increase from top to bottom. To decrease the values from top to bottom, set YDir to 'normal'. This setting reverses both the y-axis and the image."
One way to change the direction of the Y axis is to use the axis function with a ydirection input, axis xy.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrange についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by