Concatenation in gtext for plots

4 次查看(过去 30 天)
Eric Metzger
Eric Metzger 2019-11-1
Greetings,
I am having trouble concatenating text for plots/graphs using the gtext command. I can get the plot to do exactly what I want without the concatenation but once I try it, I get the following error:
Error using gtext (line 35)
Property value pairs expected.
Here is the code that I am using:
chart1=[ptfdgp1; ptfdpt25; ptfdpt5; ptfdpt75; prdlt1in];
% temporary variables for the chart
yt1=num2str(ptfdgp1);
yt2=num2str(ptfdpt25);
yt3=num2str(ptfdpt5);
yt4=num2str(ptfdpt75);
ty5=num2str(prdlt1in);
% Bar chart that shows forecast precipitation error
barh(chart1)
yticklabels({'<0.01 in','<0.25 in',' <0.50 in','<0.75 in', '<1 in,'});
xlabel('The Precent rainfall accuracy');
ylabel('Rainfall Error Category');
title('Rainfall Accuracy');
gtext([yt1], '%','fontweight',' bold', 'color','w');
gtext([yt2], '%','fontweight','bold', 'color','w');
gtext([yt3], '%','fontweight','bold','color','w');
gtext([yt4], '%','fontweight','bold','color','w');
gtext([yt5], '%','fontweight','bold','color','w');
print('-dpdf','FcstPrecipAcc')
My end goal is to get the main text to be dynamic and not require me to check the output before putting the value into gtext to finsh the graph.
Thoughts?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Labels and Annotations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by