same y label on both sides of contourf
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Richard
el 16 de Ag. de 2012
Comentada: Jan
el 12 de Feb. de 2019
From the following example:
[C,h] = contourf(peaks(20),10);
colormap autumn
How would I include the yaxis on the left hand side as well as the right hand side i.e. have the yaxis on both sides of the plot?
0 comentarios
Respuesta aceptada
José-Luis
el 16 de Ag. de 2012
Here goes, plotting an extra axes in the same position, making it transparent and changing the location of the y-axis.
[C,h] = contourf(peaks(20),10);
colormap autumn
add = gca;
extra = axes('Position',get(add,'Position'),'Color','none','XTick',[],'YAxisLocation','right');
linkaxes([add extra],'xy');
The set Position is probably unnecessary.
0 comentarios
Más respuestas (1)
Oleg Komarov
el 16 de Ag. de 2012
Alternatively you can just copy the old axes and paste it over:
new = copyobj(gca,gcf);
set(new,'YAxisLocation','right');
The linkaxes() will keep the two synchronized.
1 comentario
Jan
el 12 de Feb. de 2019
Diego López Acevedo wrote as flag: "to repeat axis on the same graph"
@Diego: Please use flags only to inform admins about content, which might conflict with the terms of use, e.g. by rudeness or spam. Thanks.
Ver también
Categorías
Más información sobre Graphics Object Properties en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!