Concatenation in gtext for plots

1 visualización (últimos 30 días)
Eric Metzger
Eric Metzger el 1 de Nov. de 2019
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?

Respuestas (0)

Categorías

Más información sobre Labels and Annotations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by