Children of axes after using yyaxis right

6 visualizaciones (últimos 30 días)
Jonas Schütz
Jonas Schütz el 19 de Jun. de 2023
Respondida: Adam Danz el 19 de Jun. de 2023
Why does children not include a and how would I get a(only using ax, b or c)?
% Create the axes object
ax = axes();
% Plot 'a' and 'b' using the same axes
a = plot(ax, 1:10, 1:10, 'DisplayName', 'Test');
yyaxis right
b = plot(ax, 1:10, ones(10, 1), 'DisplayName', 'TestRight');
hold on
c = plot(ax, 1:10, 0.5*ones(10,1), 'DisplayName', 'TestRight2');
% Access the children of the parent object
children = ax.Children
children =
2×1 Line array: Line (TestRight2) Line (TestRight)

Respuesta aceptada

Adam Danz
Adam Danz el 19 de Jun. de 2023
% Create the axes object
ax = axes();
% Plot 'a' and 'b' using the same axes
a = plot(ax, 1:10, 1:10, 'DisplayName', 'Test');
yyaxis right
b = plot(ax, 1:10, ones(10, 1), 'DisplayName', 'TestRight');
hold on
c = plot(ax, 1:10, 0.5*ones(10,1), 'DisplayName', 'TestRight2');
% Access the children of the parent object
yyaxis left
children = ax.Children
children =
Line (Test) with properties: Color: [0 0.4470 0.7410] LineStyle: '-' LineWidth: 0.5000 Marker: 'none' MarkerSize: 6 MarkerFaceColor: 'none' XData: [1 2 3 4 5 6 7 8 9 10] YData: [1 2 3 4 5 6 7 8 9 10] Show all properties

Más respuestas (0)

Categorías

Más información sobre Specifying Target for Graphics Output en Help Center y File Exchange.

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by