How to use Plot Browser's toggle ability when using multiple tiles

19 visualizaciones (últimos 30 días)
I have 3 sets of data: temperature, humidity, and pressure plotted against time for around 40 products.
I would like to be able to view the data on separate plots, but also toggle each item's plots on and off, preferably all 3 sets simultaneously, so I can compare the products' exposures.
Currently, I have the 3 plots tiled vertically, and am using linkaxes so I can zoom in on a time period in the temperature set, for instance, and see the changes in humidity and pressure at the same time (see code below).
However, I can't seem to get the toggle buttons to appear for the 40 products when using plotbrowser. I've tried giving each set a separate legend, as well as trying to implement a shared legend, but to no avail. Is what I want to do possible? I'm sure it's possible through using toggle buttons and a GUI, but that's something I've not taught myself yet, and I imagine will require the creation of 40 functions...
Any help anyone can provide would be greatly appreciated.
All the best
tiledlayout(3,1);
for y = 1:numel(serial_list)
nexttile(1)
plot(x, y_temp(:,y));
hold on
nexttile(2)
plot(x, y_humidity(:,y));
hold on
nexttile(3)
plot(x, y_pressure(:,y));
hold on
end
ax1 = nexttile(1)
ax2 = nexttile(2)
ax3 = nexttile(3)
linkaxes ([ax1, ax2, ax3], 'x');
plotbrowser

Respuesta aceptada

Adam Danz
Adam Danz el 21 de En. de 2020
Editada: Adam Danz el 22 de En. de 2020
TL;DR: The plotbrowser apparently doesn't work with TiledChartLayout axes. Instead, use subplot() to create your axes.
plotbrowser (introduced before 2006) apparently doesn't work with TiledChartLayout objects (introduced in r2019b). Fortunately plotbrowser works with axes created by the subplot function (introduced before 2006).
for y = 1:numel(serial_list)
ax1 = subplot(3,1,1);
plot(x, y_temp(:,y));
hold on
ax2 = subplot(3,1,2);
plot(x, y_humidity(:,y));
hold on
ax3 = subplot(3,1,3);
plot(x, y_pressure(:,y));
hold on
end
linkaxes ([ax1, ax2, ax3], 'x');
plotbrowser
  5 comentarios
Adam Danz
Adam Danz el 23 de En. de 2020
Editada: Adam Danz el 23 de En. de 2020
I understand what you mean but i don't see much flexibility in the function's documentation. I don't think that's do-able.
I have an idea for a workaround, though. When you toggle the plot object on/off using the plotbrowser, you're merely changing its visible property to off/on. You could add a listener that responds when the visibile property is changed in any of the plot objects. The options to toggle on/off the objects within each subplot will still be shown but if the listener is set up correctly, if you turn one object off its corresponding objects in the other axes will also go off (or back on).
That will require a bit of coding, especially if you haven't set up a listener before.
Charles Lewis
Charles Lewis el 23 de En. de 2020
I have never set up a listener before, but I'm eager to try! That sounds like a great workaround.
Thanks again for your time and help.
All the best

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by