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

Enter in XTickLabel , how to?

Asked by Hello kity on 20 Dec 2012

I am editting a graph. I was giving names to each bar with xticklabel. But the way it creates isnt looking nice.

 set(gca,'XTickLabel',{['bar1' num2str(DATA)]})

this creates below the bar,

 bar1 DATA

what i want is

  • bar1
  • DATA (enter in between)

so how to do this?


Hello kity


No products are associated with this question.

2 Answers

Answer by Jan Simon on 20 Dec 2012
set(gca,'XTickLabel', ['bar1', char(10), num2str(DATA)])

1 Comment

Hello kity on 21 Dec 2012

char(10) creates a square next to 'bar1'. it doesnt enter...

Jan Simon
Answer by Hello kity on 21 Dec 2012

char(10) didnt do the job, does anyone else know how you can make matlab use a second line in the x-axis?


Hello kity

Contact us