Colorbar cannot be added to another colorbar.

2 visualizaciones (últimos 30 días)
Stefanie
Stefanie el 10 de En. de 2013
I have a GUI with several contour maps and colorbars related to these contour maps. I would like to choose and change the data for the contour map via popup in the GUI, which works well with the contour maps. If I want to change the colorbar I get the message: "Colorbar cannot be added to another colorbar."
Code:('contents' is the parameter chosen in the popup menu)
switch contents
case 1
contourf(handles.axes1,handles.qx,handles.qy,handles.dataset1);
colorbar(handles.axes2);
case 2
contourf(handles.axes1,handles.qx,handles.qy,handles.dataset2);
colorbar(handles.axes2);
end
I tried "cla" or "colorbar('delete')" at the beginning of the cases, but no success. How can I replace the colorbar?

Respuestas (1)

Image Analyst
Image Analyst el 10 de En. de 2013
Maybe try the delete option before you call it:
colorbar('delete');
colorbar(handles.axes2);
  1 comentario
Stefanie
Stefanie el 10 de En. de 2013
Editada: Stefanie el 10 de En. de 2013
The first colorbar is always plotted. Only if I try to write a new colorbar (new: based on new data from the contour plot), then the error appears. btw. the error refers to the following:
Error using colorbarv6 (line 214)
Colorbar cannot be added to another colorbar.
Besides this there is a warning:
Warning: The 'v6' argument to COLORBAR is deprecated, and will no longer be supported in a future release.
> In colorbar at 71
In closereq at 24
Maybe this can help to find the solution...

Iniciar sesión para comentar.

Categorías

Más información sobre Colorbar en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by