How can I change the x-axis to log scale using boxplot?

조회 수: 6 (최근 30일)
Therese
Therese 2013년 5월 9일
I have plotted my data using boxplot, but now I would like to change the x-axis to log scale.
I have used this command: set(gca,'XScale','log') However, the size of the boxes become unequal (some of them are wider than the others...)
I would also like to change the scale (xlim) to go from 1000 to 0, but when I try this error message shows up:
>> xlim([1000 0]) Error using set Bad property value found. Object Name : axes Property Name : 'XLim' Values must be increasing and non-NaN.
Is it possible to do this in any other way?
Thanks! /Therese

답변 (1개)

Grzegorz Knor
Grzegorz Knor 2013년 5월 9일
First question:
Can you write small example? Because I don't understand fully your problem.
Second question:
Instead of:
xlim([1000 0])
use:
xlim([0 1000])
  댓글 수: 3
Grzegorz Knor
Grzegorz Knor 2013년 5월 10일
Is this the solution to your problem:
X = 3+abs(200*randn(100,25));
boxplot(X)
set(gca,'yscale','log','ydir','reverse')
ylim([1 1000])
?
Therese
Therese 2013년 5월 10일
No... unfortunately, it doesn't work. I can reverse the x-axis, but the boxes still change in width, and the distance between the lowest light intensity and the second lowest light intensity is larger (3.4 - 6 lux), than the distance between 190 - 600 lux, for example. Do you have any other idea?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Log Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by