How to create a plot with strings?

I need create a plot like this:(similar)
Data:
category= { } with 90x1 could be Beef & Pork, Chicken & Fish or Salads
fat and calories is a 90x1 too
I try to do:
figure(1)
xlabel('Fat')
ylabel('Calories')
if category=="Beef & Pork"
plot(fat, calories, 'd')
end
if category=="Chicken & Fish"
plot(fat, calories, 'o')
end
if category=="Salads"
plot(fat, calories, 'x')
end
But only read the first element.

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by