Effacer les filtres
Effacer les filtres

How to move matlab.gra​​phics.pri​m​itive.Im​ag​e (output of imagesc) within a figure?

1 vue (au cours des 30 derniers jours)
Kristen Meyer
Kristen Meyer le 27 Mai 2019
Commenté : Kristen Meyer le 27 Juin 2019
Hi,
I have a function that is producing a spectrogram of data using imagesc, placing it in a figure, and saving it. For reasons relating to automation testing I need to move the image result of imagesc down very slightly within the figure. I've explored converting the output of imagesc to another format, however, that breaks other bits of code later on. All the normal get and set functions don't work as it is a matlab.graphics.primitive.Image.
fig = figure;
ax = axes(); % position gets set further down
set(ax, 'FontSize', FONT_SIZE_AXES(SpecInfo.resMode), 'Layer', 'Top')
imagesc(SpecData.time, (SpecData.freq/freqScale), SpecData.data);
axis xy
ylim(minmax(SpecData.freq/freqScale))
colormap(cm);
set(ax, 'Clim', colourScale);
This goes on to add all the titles, axis information, and such and save it as a png using ghostscript. All the normal get and set functions don't work as it is a matlab.graphics.primitive.Image. Perhaps the easist way is to convert to a rbg image array move it and then convert back to a matlab.graphics.primitive.Image? Or change the rest of the code to handle a rgb image array?
  1 commentaire
Kristen Meyer
Kristen Meyer le 27 Juin 2019
Figured it out a while ago thought I would leave the answer. Load the image into an axes and then it is possible to move the axes around and resize with the normal set(gca, 'position', [a b c d])

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Graphics Object Programming dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by