how to plot percentage on y axis
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
sir,i want to plot a variable 'L 'which is for life time of mobile nodes.i am getting the 'L' result numerically but its not showing on the graph.i want to plot it in both normal graph form and histogram form.i need the graph in percentage form i mean the y-axis should show the result in percentage and x-axis must show a fixed time .that means i m not taking any variable for expressing time.i found some expression from internet like below.but i m not getting exactly how to write the proper command.
hist(L); h=gca; labels=get(h,'yticklabel'); % get the y axis labels labels_modif=[num2str(100*str2num(labels)) ones(length(labels),1)*'%'] set(h,'yticklabel',labels_modif);
its only showing the y-axis labeling as percentage but not the exact result. pllzz help me sir.its urgent. Expecting a favorable reply. Thanking u SUCHI.
0 Commenti
Risposte (1)
Oleg Komarov
il 15 Mag 2011
Here's an example of how to set % values for the Y axis:ù
% Example input
L = 0:.1:1;
% Plot
plot(1:numel(L),L);
% Create labels
labels = reshape(sprintf('%5.1f%%',L*100),6,[]).';
% Adjust labels on plot
set(gca,'yticklabel',labels)
2 Commenti
Oleg Komarov
il 16 Mag 2011
Well, if you don't give me example inputs for k, N, M, lij and xij my cristal ball surely won't help.
To get percentages from a number say maxA = 10 drawn from an array A = [10 2 5 6];
L = maxA/sum(A)*100;
Vedere anche
Categorie
Scopri di più su Annotations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!