Hello,

I noticed, that bar() with log=True plots very strange graphs. In fact,
the bars in this case grow from the bottom of the graph (I guess from
the value of log(+0), i.e. -∞). This way the relative height of the bars
says almost nothing about the value of data, because the bars are
higher, the lower is ylim()[0]. It is hard to distinguish data values
above and below 1 (positive and negative log).

I think that in many situations it is more useful to base bars on
the level of log(y)=0. This is achievable with manual log-scaling of
data, yet in this case it also requires manual tuning of ylabels.

I attach a script and an image which show the default plotting in
comparison to grow-from-log(1) plotting to see the difference, and
suggest making it possible to change the level from which the bars grow.

Best regards,
jetxee

<<attachment: logbar.png>>

#!/usr/bin/env python
from pylab import *
from math import log

y=[1,0.5,0.25,0.5,1,2,4,8,16,32]
x=range(1,len(y)+1)

subplot(121)
title('with log=True\n(not much sense,\nheight depends on ylim()[0])')
bar(x,y,log=True,align='center')
xlim(x[0]-0.5,x[-1]+0.5)
ylim(1e-3,64)

ly=map(lambda x:log(x,2), y)
subplot(122)
title('manually log-scaled data\n(as I like it,\nheight shows data value)')
bar(x,ly,log=False,align='center')
xlim(x[0]-0.5,x[-1]+0.5)
ylim(-10,6)

show()

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to