On Jan 12, 2012, at 7:38 AM, Benjamin Root wrote:
Does everything work correctly if it is vertical? In other words, use bar() and set the y-axis to log scale? An example script would be useful.
No, it doesn’t appear to work as a vertical bar chart, either.
I’ve attached a test case below. The results I get running it with the X-axis as log are:
[http://thebuild.com/matlabtest/matlabtest-log.pdf](http://thebuild.com/matlabtest/matlabtest-log.pdf)
Commenting out the call to ax.set_xscale(‘log’) gives me:
[http://thebuild.com/matlabtest/matlabtest.pdf](http://thebuild.com/matlabtest/matlabtest.pdf)
Thanks!
–
import numpy as np
import matplotlib
from matplotlib.font_manager import FontProperties
import random
matplotlib.use(‘PDF’)
import matplotlib.pyplot as plot
small_font = FontProperties()
small_font.set_size(‘xx-small’)
ind = np.arange(20)
label = [ str® for r in ind ]
data1 = [ float(random.random()*100000000) for r in ind ]
data2 = [ float(random.random()*100000000) for r in ind ]
width = 0.25
fig = plot.figure()
ax = fig.add_subplot(111)
ax.set_title(‘Table Title’)
ax.set_xlabel(‘X Label’)
ax.barh(ind, data1, width, linewidth=0, color=‘blue’)
ax.barh(ind, data2, width, left=data1, linewidth=0, color=‘yellow’)
ax.set_yticks(ind + width/2)
ax.set_yticklabels(label, fontproperties=small_font)
ax.set_xscale(‘log’)
plot.savefig(‘matlabtest-log.pdf’)
–
– Christophe Pettus