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])
How to move matlab.graphics.primitive.Image (output of imagesc) within a figure?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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?
Risposte (0)
Vedere anche
Categorie
Scopri di più su Graphics Object Programming in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!