Possible to use fanplot in a GUI? (SOLVED)

조회 수: 1 (최근 30일)
orangejuice
orangejuice 2016년 4월 5일
댓글: Guido Francesco Frate 2018년 10월 12일
Is it possible to use the fanplot graph in a GUI?
I tried the following code but it opens a new graph window.
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
axesHandle= findobj(gcf,'Tag','axes1');
[hist, proj] = get_data(1000); %get historical data + 1000 simulations
axesHandle = fanplot(hist,proj);
  댓글 수: 4
Annalaura
Annalaura 2017년 10월 11일
Hi! I have the same problem! Can you maybe share the hybrid you created? would be very helpful! =) Thanks!
Guido Francesco Frate
Guido Francesco Frate 2018년 10월 12일
You can open the fanplot.m and modify the statement "h = figure" in "h = gcf" (it will use the current figure for the plot, instead of opening an additional figure). You will not be able to save the modified fanplot.m, so just copy all the function and paste it on a new m-file. I saved it as fanplot2 and added it to my matlab path, so i can use it whenever i want. With this little modification you can do useful things like putting your fan charts in subplots! In the same way you can disable the automatic grid, ylabel and title...

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

답변 (2개)

Adam
Adam 2016년 4월 5일
I don't have the Financial Toolbox so I can't test this out, but does
fanplot( hist, proj, 'parent', axesHandle );
work?

Orion
Orion 2016년 4월 5일
Hi,
I don't know this function (don't have the associated toolbox), but for what I see in the doc, you can do it.
First, check the HandleVisibility property of your figure. it should be set to callback.
Then, ckeck that your axe do have the tag axes1.
Finally, you can plot your data in the axe you want using the syntax
fanplot(hist,proj,'Parent',axesHandle);
check that axeshandle is not empty (put a breakpoint in your code at this line)
  댓글 수: 1
orangejuice
orangejuice 2016년 4월 5일
Unfortunately this doesn't work. The fanplot function doesn't allow other input arguments.
Error using fanplot
Too many input arguments.
Error in FanPlotUI>pushbutton1_Callback (line 137)
fanplot(hist, proj, 'Parent', axesHandle);

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by