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

3 次查看(过去 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 中查找有关 Formatting and Annotation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by