Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to add a log scale to a histogram?

671 views
Skip to first unread message

Mayo Mahendran

unread,
Apr 10, 2008, 7:59:02 PM4/10/08
to
I want to make my y-axis as a log scale, while keeping my
x-axis on my histogram linear. I have been searching the
internet, and have not been able to find a way.

Is it possible?

Steven Lord

unread,
Apr 10, 2008, 8:26:56 PM4/10/08
to

"Mayo Mahendran" <mayo.ma...@railcorp.nsw.gov.au> wrote in message
news:ftm9k6$ra4$1...@fred.mathworks.com...

set(gca, 'YScale', 'log')

Also read:

http://www.mathworks.com/support/solutions/data/1-15S83.html?solution=1-15S83

--
Steve Lord
sl...@mathworks.com


Georgios

unread,
Apr 10, 2008, 8:34:02 PM4/10/08
to
"Mayo Mahendran" <mayo.ma...@railcorp.nsw.gov.au> wrote
in message <ftm9k6$ra4$1...@fred.mathworks.com>...

Using Matlab R2006b, I plot the histogram. Then on the
figure window, click Edit, then Axes Properties. Select Y
axis, then Y scale and choose Log. Depending on your
histogram range, it might not look like a histogram after
changing your Y axis to logarithmic.

Regards,
Georgios

Mayo Mahendran

unread,
Apr 10, 2008, 9:31:04 PM4/10/08
to
"Steven Lord" <sl...@mathworks.com> wrote in message
<ftmb8g$484$1...@fred.mathworks.com>...

Thanks, I did try 'set(gca, 'YScale', 'log')' on the
histogram, however the bars disapeared and I assumed that
it just couldn't be done that way.

I put the histogram data into a bar graph and then using
your code and it worked.

Thanks for the help.

Adam Ralston

unread,
Jul 12, 2010, 5:23:04 PM7/12/10
to
0 new messages