Hide trendlines on plots, via app designer
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Dharmesh Joshi
il 20 Gen 2023
Commentato: Dharmesh Joshi
il 24 Gen 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 Commenti
Risposta accettata
dpb
il 20 Gen 2023
Modificato: dpb
il 21 Gen 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 Commenti
dpb
il 21 Gen 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...
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!