Hide axis from plot with image

115 vues (au cours des 30 derniers jours)
Thomas Foley
Thomas Foley le 30 Sep 2022
Commenté : Thomas Foley le 1 Oct 2022
Hi,
I'm looking to hide the axis labels on the plot on the left in the below image.
The image is a subplot with an image of a videoframe in the plot. I'd like to hide remove the x and y axis values that surround the image.
I've looked online and tried using set(gca ...) with multiple combinations:
set(gca,'visible','off')
set(gca,'xtick',[],'ytick',[])
set(gca,'xtick',[],'ytick',[])
I've also tried
axis off
Here is the code to generate the image:
figure;
fig = gcf;
fig.WindowState = 'maximized';
ax_Vid = subplot(2,2,[1,3], 'Parent', fig);
cropBox = [824.5100 267.5100 311.9800 536.9800];
hold on
videoFrame=imcrop(videoFrame,cropBox);
image(ax_Vid, videoFrame)
axis off
hold off
Thanks for your help

Réponse acceptée

Eric Delgado
Eric Delgado le 30 Sep 2022
fig = figure;
ax1 = subplot(2,2,[1,3], 'Parent', fig);
I = imread("YourImage.png");
image(ax1, I)
set(ax1, 'XTickLabel', {}, 'YTickLabel', {})
  1 commentaire
Thomas Foley
Thomas Foley le 1 Oct 2022
This worked great!
Thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Printing and Saving dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by