필터 지우기
필터 지우기

Hide trendlines on plots, via app designer

조회 수: 11 (최근 30일)
Dharmesh Joshi
Dharmesh Joshi 2023년 1월 20일
댓글: Dharmesh Joshi 2023년 1월 24일
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
Cameron
Cameron 2023년 1월 20일
Can you show us what you're talking about?
Dharmesh Joshi
Dharmesh Joshi 2023년 1월 20일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

dpb
dpb 2023년 1월 20일
편집: dpb 2023년 1월 21일
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
dpb
dpb 2023년 1월 21일
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 2023년 1월 24일
Thanks the set command works.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by