text labels for x values
- From: Jon <ericksonNOspamplease@xxxxxxxxxxx>
- Date: Fri, 29 Jun 2007 23:24:59 -0400
Hi all,
I am trying to create a bar graph that has text for x values.
For a (silly) example, let's say I have 4 values representing how
much of each type of fruit is in my fridge:
fruit = [2 5 6 7]
bar(fruit)
makes the bar plot just fine.
But here's what I want and am having trouble with:
Instead of the default x values being numeric (1 through 4)
I want to have x values be text. something like ['apples',
'oranges', 'strawberries', 'pears'].
Tried this and it doesn't work.
For instance if i do:
mylabels =['apples', 'oranges', 'strawberries', 'pears'];
bar(mylabels, fruit)
??? Error using ==> bar at 49
Must supply Y data or X and Y data as first argument(s).
I opened up bar.m and can't see how to edit it for a workaround,
except maybe seriously hacking into parseparams.m and bar.m. I was
hoping someone had an easy way to do this...maybe just adding text
below the x axis?
Didn't see any examples like this anywhere I searched.
So, if anyone out there knows how to do this, I would really
appreciate it.
thanks. jon
.
- Follow-Ups:
- Re: text labels for x values
- From: NZTideMan
- Re: text labels for x values
- Prev by Date: A Question about Simulink
- Next by Date: Pls, I need some help on fzero's optimset settings.
- Previous by thread: A Question about Simulink
- Next by thread: Re: text labels for x values
- Index(es):
Relevant Pages
|