gui plotting on axes

1 view (last 30 days)
andrew krugle
andrew krugle on 19 Oct 2018
Commented: Kevin Chng on 19 Oct 2018
Im trying to attach a plot to an axes in a gui. Ive tried the following with no luck
function axes1_CreateFcn(hObject, eventdata, handles)
% hObject handle to axes1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
ax = handles.axes1;
l=15;
x=0:0.01:l*cosd(20);
y=tand(20)*x;
plot(x,y,'b')
x=100:-0.01:70-l*cosd(theta);
y=-tand(20)*x+tand(20)*70;
hold on;
plot(ax,x,y,'g')
ylim([0 15])
Ive also tried
axes(handles.axes1)
l=15;
x=0:0.01:l*cosd(20);
y=tand(20)*x;
plot(x,y,'b')
x=100:-0.01:70-l*cosd(theta);
y=-tand(20)*x+tand(20)*70;
hold on;
plot(x,y,'g')
ylim([0 15])
  1 Comment
Kevin Chng
Kevin Chng on 19 Oct 2018
why don't you assign the axes for first plot?
plot(ax,x,y,'b')

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!