Borrar filtros
Borrar filtros

Hide trendlines on plots, via app designer

11 visualizaciones (últimos 30 días)
Dharmesh Joshi
Dharmesh Joshi el 20 de En. de 2023
Comentada: Dharmesh Joshi el 24 de En. de 2023
Hi
I am using App designer to design my App. This App has multiple plots. Each plots has few trends.
Is there away to hide certain trends, either directly on the plot or via another function associated with radio or check box?
  2 comentarios
Cameron
Cameron el 20 de En. de 2023
Can you show us what you're talking about?
Dharmesh Joshi
Dharmesh Joshi el 20 de En. de 2023
Hi
This is my plot. I would like to be able to select any of the three trends as the only dataset to display on the plot, without any other datashet, but it has to be dynamic either an option on the plot or i can create a function via the GUI.

Iniciar sesión para comentar.

Respuesta aceptada

dpb
dpb el 20 de En. de 2023
Editada: dpb el 21 de En. de 2023
You forgot to show us how you're creating the plot, but if you will save the line handles when plotting, then you can toggle the 'Visible' property on/off. If you'll add a 'DisplayName' property value to the lines as well, you could have a user-selectable listbox or the like to choose which to show with given name, linestyle, etc., etc., etc., ...
  3 comentarios
dpb
dpb el 21 de En. de 2023
As noted, save the line handles when you plot them...you'll probably need to create another array for them with the app global struct so they are available after the callback function that draws them finishes for the user selection callback, however you choose to have the user pick which are the one(s) of interest, but you need the handles first...
temp_table=table(app.electrosensors_table{app.SelectSensorDropDown.Value}.Temperature,app.electrosensors_table{app.SelectSensorDropDown.Value}.Humidity,app.electrosensors_table{app.SelectSensorDropDown.Value}.NO2,'VariableNames',["Temperture","Humdity","Sensor"]);
corrected_model_data= app.model1_example.Model1.RegressionGP.predict(temp_table);
hold(app.UIAxes2,'off')
app.hL=plot(app.UIAxes2, ...
app.electrosensors_table{app.SelectSensorDropDown.Value}.Time, ...
app.electrosensors_table{app.SelectSensorDropDown.Value}.NO2, ...
'DisplayName','NO2');
hold(app.UIAxes2,'on')
app.hL(2)=plot(app.UIAxes2, ...
app.sensor_table_data(1).ref_timetable_period.locationA.ref_time, ...
app.sensor_table_data(1).ref_timetable_period.locationA.ref_data, ...
'DisplayName','Reference');
app.hL(3)=plot(app.UIAxes2, ...
app.electrosensors_table{app.SelectSensorDropDown.Value}.Time, ...
corrected_model_data, ...
'DisplayName','Corrected');
...
Then, whichever are the user selected to toggle, use
ixDoNotShow=resultFromUserSelectionInterfaceHoweverYouChooseToPick;
set(app.hL(ixDoNotShow),'Visible','off')
If/when the user reselects to turn back on, then simply reset 'Visible','on' again.
A uilistbox would be one way to list the 'DisplayName' property value for the three lines and let the user select one or more of those to be shown. There should be a button group or check box group with the multi-select capability as well, but I'm not all that familiar with the app designer control set and didn't see it in a quick look...
Dharmesh Joshi
Dharmesh Joshi el 24 de En. de 2023
Thanks the set command works.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by