Matlab: How to boxplot sparse data with coherent spacing on x axis -


i have boxplot data matlab.

and have labels:

x = [1 , 2 , 3 , 5 , 10 , 50 , 100 , 110 , 150 , 200 ] 

and have data, say:

for j=1:10 i=1:10 y(j,i) = x(i)*rand() end end 

now when launch boxplot(y,x) obtain fixed gap between x labels. example 1 has same distance 2 of 150 200. how can set distance proportional actual gap?

assuming (from comments) you're using boxplot statistics toolbox:

in boxplot(data,x), x assumed information on groups - e.g. not positions along x-axis information on how group data. in example using built in data:

load carsmall boxplot(mpg,model_year) 

both mpg , model_year 100 x 1 doubles - model_year contains 3 unique values (70, 76, 82), e.g. number of groups in data 3. output plot 3 boxes showing mpg 3 years - position, default, of boxes 1:numgroups.

you can change behaviour, need use parameters:

data = randn(100,7); x = [1 , 2 , 3 , 5 , 10 , 50 , 100]; boxplot(data,'position',x) 

you might need play of other plotting parameters (box width, etc) make nice.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -