フィルターのクリア

When can the official provide a built-in zoom function for the figure?

5 ビュー (過去 30 日間)
Ren
Ren 2024 年 1 月 29 日
回答済み: Shivam 2024 年 2 月 6 日
I think many people need a convenient and fast built-in zoom function for the figure. Will mathworks considering add this feature in the future?
  2 件のコメント
Bruno Luong
Bruno Luong 2024 年 1 月 29 日
編集済み: Bruno Luong 2024 年 1 月 29 日
What else do you need beside what already provided by zoom function (see syntax with factor) and directly manipulate xlim, ylim zlim?
Ren
Ren 2024 年 1 月 29 日
I mean, plus a mini figure with part of data at the original figure. The current method of adding coordinate axes is quite complex to operate.

サインインしてコメントする。

採用された回答

Shivam
Shivam 2024 年 2 月 6 日
Hi Ren,
Based on what you have described, it seems that you want to zoom in on a certain portion of the figure using a built-in feature.
The MATLAB's current figure does not inherently offer a feature for zooming in and out and displaying the zoomed-in section in a mini figure, and I am not aware of their future upcoming features. But you can follow the below possible workarounds:
  • Adding a new axes of the zoomed-in section in the same figure
% Define a time vector
t = linspace(0, 2*pi, 1000);
x = sin(t);
kinkLocation = pi;
kinkMagnitude = 0.5;
% Add a kink to the sine wave
modifiedSignal = x + (t > kinkLocation) * kinkMagnitude;
% Plot the sine wave with the kink
figure, plot(t, modifiedSignal)
xlabel('Time'), ylabel('Amplitude')
title('Sine Wave with a Kink')
% Create a new axes in the same figure window to show the zoomed in version
axes('position',[.65 0.67 .25 .25])
box on % put box around new pair of axes
indexOfZoomedIn = (t < pi+1) & (t > pi - 1);
plot(t(indexOfZoomedIn),modifiedSignal(indexOfZoomedIn)) % plot on new axes
axis tight;
  • Adding a scroll panel, magnification box, and an overview tool to figure showing the image
% Display an image in a figure
hFig = figure(Toolbar="none",Menubar="none",Name="strawberri");
hIm = imshow('strawberries.jpg');
% Create a scroll panel to contain the image
hSP = imscrollpanel(hFig,hIm);
set(hSP,Units="normalized",Position=[0 .1 1 .9]);
% Add a Magnification Box and an Overview tool to the figure
hMagBox = immagbox(hFig, hIm);
boxPosition = get(hMagBox, 'Position');
set(hMagBox,Position=[0 0 boxPosition(3) boxPosition(4)]);
imoverview(hIm)
You can refer to the following documentations to know more about 'imscrollpanel', 'immagbox', and 'imoverview' functions:
I hope it helps in resolving the issue.
Thanks.

その他の回答 (0 件)

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by