GUI - Text to label scatter plot data gets ignored / only works when running function multiple times

조회 수: 1 (최근 30일)
Hi all,
The following function in a GUI (linked to a push button) displays a scatter plot, which works fine However, the TEXT function to label the data points does not work (without an error message being shown), no data labels are being displayed. It sometimes works after running the function multiple times but also without clear pattern. Any ideas?
Thanks for the help!
%Create Chart
x_axis = data.DUR_ADJ_MID(issuer,:);
y_axis = data.YAS_ZSPREAD(issuer,:);
c_colour = colourcode(issuer,:);
scatter(handles.CHART1,x_axis,y_axis,12,c_colour,'filled');
title(handles.CHART1,'Market Screening');
xlabel(handles.CHART1,'Mod. Duration');
ylabel(handles.CHART1,'Z-Spread');
ylim(handles.CHART1,[ZS_MIN ZS_MAX]);
text(x_axis+0.02,y_axis,data.SECURITY_DES(issuer,:),'FontSize',7,'Color',[1 1 1]);
set (handles.CHART1, 'Color', [0 0 0] );
set (handles.CHART1, 'XColor', [1 1 1] );
set (handles.CHART1, 'YColor', [1 1 1] );

답변 (1개)

Sid
Sid 2015년 6월 30일
Should there be a hold on between ylim and text?
Also, one thing I find useful when setting axes is to have a clear axes set up at the beginning of the plot handle I am about to plot in. That way, I am always sure that there are not artifacts from the previous plot left behind.
There is an example from a similar question here.
HTH.

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by