Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
XData as strings for bar charts

Subject: XData as strings for bar charts

From: Misha Koshelev

Date: 12 Jun, 2009 22:04:02

Message: 1 of 3

Hi, I was wondering if there is any way to label the elements of a bar chart with strings?

Thank you
Misha

Subject: XData as strings for bar charts

From: Rylan Cox

Date: 24 Jun, 2009 20:24:01

Message: 2 of 3

You can try this:

bar(data);

set(gca,'XTick',1:numel(datastring));

set(gca,'XTickLabel', datastring);

Where datastring is a cell array that includes the labels that you want to use for the bar chart. I'm not sure if that is the best way, but I've gotten it to work. Good luck!

rylan



"Misha Koshelev" <mk144210@bcm.edu> wrote in message <h0ujci$asp$1@fred.mathworks.com>...
> Hi, I was wondering if there is any way to label the elements of a bar chart with strings?
>
> Thank you
> Misha

Subject: XData as strings for bar charts

From: Misha Koshelev

Date: 24 Jun, 2009 20:45:03

Message: 3 of 3

"Misha Koshelev" <mk144210@bcm.edu> wrote in message <h0ujci$asp$1@fred.mathworks.com>...
> Hi, I was wondering if there is any way to label the elements of a bar chart with strings?
>
> Thank you
> Misha

http://www.mathworks.com/matlabcentral/fileexchange/3486

Thanks. Here is what I used. It does something weird with margins though.

Misha

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us