get plotyy second axis handle
Mostrar comentarios más antiguos
I know I can get the second axis handle for plotyy with
[AX,~,~] = plotyy(x1,y1,x2,y2)
and the handle is AX(2) but i use the plotyy function inside another function so AX is deleted because its a local variable
when i use gca (after running the function) in the command window I get what would be AX(1)
So my question is how to get the second axis handle after running the function
Respuesta aceptada
Más respuestas (2)
Jarrod Rivituso
el 13 de Abr. de 2011
This also would work:
secondAxes = findobj('Type','axes','Color','none')
4 comentarios
Zakary Stone
el 13 de Abr. de 2011
Jarrod Rivituso
el 13 de Abr. de 2011
no problem. fyi, the reason this works is because plotyy works by creating two axes on top of one another, with the second axes' white background missing. so, you can easily find that second axes by looking for an axes that has it's 'Color' property set to 'none'
Zakary Stone
el 14 de Abr. de 2011
Paulo Silva
el 14 de Abr. de 2011
All the solutions provided work just fine :)
Zakary Stone
el 13 de Abr. de 2011
Categorías
Más información sobre Two y-axis en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!