필터 지우기
필터 지우기

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