Want to plot a table that has both text and numbers into a pie chart

4 views (last 30 days)
I have a table that has both text and numerical values:
{'Alabama' } {[ 227433]}
{'Alaska' } {[ 12107]}
{'Arizona' } {[ 193063]}
{'Arkansas' } {[ 138372]}
{'California' } {[ 1141776]}
How can I label the values in a pie chart with their corresponding state?
I am unable to plot the pie chart as 'pie(raw)' as I need 'numeric data in the pie chart.'

Accepted Answer

KSSV
KSSV on 12 Feb 2019
T = [{'Alabama' } {[ 227433]}
{'Alaska' } {[ 12107]}
{'Arizona' } {[ 193063]}
{'Arkansas' } {[ 138372]}
{'California' } {[ 1141776]}] ;
X = cell2mat(T(:,2)) ;
labels = T(:,1) ;
pie(X,labels)

More Answers (0)

Community Treasure Hunt

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

Start Hunting!