Rank: 247435 based on 0 downloads (last 30 days) and 0 file submitted
photo

Sam

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Comments and Ratings by Sam View all
Updated File Comments Rating
19 Dec 2012 Break Bar Plot Add breaks in the bar plot Author: Chintan Patel

Cool, and I plan to turn this into a histogram version at some point. One note — delete line 56 to have the function actually listen to your choice for break_type. As it is now, it always sets break_type = 'Patch'.

22 Jun 2012 Rotate X-axis tick labels Rotate x-tick labels to any angle, preserving font settings and coping with resize, zoom, pan etc Author: Ben Tordoff

Thanks for the sweet function. However, I'm also getting an "Index exceeds matrix dimensions" error with R2012a, and I isolated what's causing the problem for me at least (although I have no idea why). The code below simulates the scenario I'm working on. When I set 'YGrid' to 'on', I get the error that follows the code. No error when I leave out a 'YGrid' specification. (Note that the code seems to execute just fine despite the error, so it's not a huge deal.)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

% Create fake data
%%% 14 groups of 4 percentages, each group adding to 100
data = zeros(14,4) ;
data(:,1) = randi(100,14,1) ;
for y = 2:3
for x = 1:14
if sum(data(x,:)) == 100
continue
end
data(x,y) = randi(100-sum(data(x,:)),1,1) ;
end
end
for x = 1:14
data(x,4) = 100 - sum(data(x,:)) ;
end

% Make grouped bar graph
bar(data,'grouped') ;
xlabels = char('Grp01','Grp02','Grp03','Grp04','Grp05','Grp06','Grp07','Grp08','Grp09','Grp10','Grp11','Grp12','Grp13','Grp14') ;
set(gca,'XTickLabel',xlabels,'YLim',[0 100],'YGrid','on')
rotateXLabels(gca,45)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Here's the error message:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Index exceeds matrix dimensions.

Error in rotateXLabels/getLabelHeight (line 226)
oldUnits = get( textLabels(1), 'Units' );

Error in rotateXLabels/repositionXLabel (line 204)
labelHeight = getLabelHeight(ax);

Error in rotateXLabels/onAxesLimitsChanged (line 353)
repositionXLabel( ax );

Warning: Error occurred while evaluating listener callback.
> In graphics/private/clo at 83
In cla at 29
In newplot>ObserveAxesNextPlot at 125
In newplot at 74
In bar at 76

Contact us