How to change the colorbar limits in a previously saved fig file
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ricardo Duarte
el 11 de Oct. de 2021
Comentada: Ricardo Duarte
el 14 de Oct. de 2021
Hello,
I have a figure containing a colorbar that I saved in a .fig format.
Now I need to open it and change the limits of the color bar. Im using
caxis([inferior_limit superior_limit])
.
However, when I do this nothing happens.
What Im doing wrong?
Thank you
0 comentarios
Respuesta aceptada
Walter Roberson
el 11 de Oct. de 2021
figfilename = 'AppropriateFile.fig';
fig = openfig(figfilename);
cb = findobj(fig, 'type', 'Colorbar');
cb.Limits = [inferior_limit superior_limit];
After that you might want to save the figure indicates in fig into a new file.
7 comentarios
Walter Roberson
el 13 de Oct. de 2021
imagesc() sets the image 'CDataMapping', 'scaled' . If a non-empty scale range is provided, then it also sets the axes CLim property to that range; if "hold" was off then it also sets the axes CLimMode to 'auto'
This is almost the same calling imagesc() without a range and then calling caxis() yourself; the difference is just in whether CLimMode is set to 'auto' or not (caxis does not set it.)
If you still have your figure up but you want to change the caxis and save again while it is still up, then referring to your previous code,
caxis(ax1, [inferior_limit superior_limit]);
savefig(SPLfigure, 'teste.fig')
Más respuestas (0)
Ver también
Categorías
Más información sobre Grid Lines, Tick Values, and Labels en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!