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

조회 수: 1 (최근 30일)
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
Kristen Meyer
Kristen Meyer 2019년 6월 27일
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])

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by