Home plot categorization of strings, matlab
Reply: 0

plot categorization of strings, matlab

user996
1#
user996 Published in May 21, 2018, 11:18 am

Edit: while the solution suggested works this format is problematic when I have many long strings, any suggestions?

Lets say I have categorized a vector of M stings into N groups. Meaning each of the M strings is assigned a number between 1 to N indicating the category the string belongs into. For example if M=6 and N=3 I might have:

v = [ 'a' ; 'b' ; 'c' ; 'd' ; 'e' ; 'f' ]
c = [  1  ;  2  ;  1  ;  1  '  3  ;  2  ]

which indicates that a, c and d were all categorized to group "1". "e" was categorized to group 3.

I want to somehow plot - using Matlab - this categorization.

I am trying something along the lines of:

plot(v,'b--o')
set(gca,'xticklabel',c.')

but I need the plot to look more like a scatter, sadly it seems scatter does not work with strings. Any suggestions?

Plus, the vector of strings might get very long, anyone knows how to make the plot scrollable?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.304719 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO