Cannot draw bar chart with log scale

Hi,

I have some difficulty to use the log scale on bar chart. Could anybody help me, thanks in advace.

Regards,
afancy

from matplotlib.font_manager import FontProperties
data=((0.014, 0.512, 0.015, 0.161, 1.177, 6.793, 0.089, 1.495, 25.65, 0.014, 0.045, 0.052, 5.423),

  (0.529, 0.612,   0.855, 0.178,  1.432, 6.43,   41.311,  1.62,   71.012,  1.59,   0.271,  0.066,  4.721),
  (0.493, 834.351, 0.156, 743.193,0.428, 84.101, 1058.062,8.652,  1023,    0.168,  7.101,  8.135,  152.646),

  (118.90,2035.35, 89.35, 15.402, 10.856,110.049,3024.42, 8054.74,5214.36, 5.539,  11.539, 515.632,150.411)
  )

rects=[]
xticks=[]
patterns = (’/’,‘x’, ‘\’,‘o’)

colors=[‘r’,‘b’,‘y’, ‘g’]

fig = figure()
ax=fig.add_subplot(111)

ax.set_yscale(‘log’)
ax.set_ylim(1e-4, 1e5)
width=0.1

for q in range(13):
for n in range(4):

    l = q+width*n
    h = data[n][q]
    w =  width
    rect, = ax.bar(l, h, w, bottom=0, fill=False, hatch=patterns[n], log=True)

draw()

···

Hi,

I have some difficulty to use the log scale on bar chart. Could anybody help me, thanks in advace.

Regards,
afancy

from matplotlib.font_manager import FontProperties
data=((0.014, 0.512, 0.015, 0.161, 1.177, 6.793, 0.089, 1.495, 25.65, 0.014, 0.045, 0.052, 5.423),

  (0.529, 0.612,   0.855, 0.178,  1.432, 6.43,   41.311,  1.62,   71.012,  1.59,   0.271,  0.066,  4.721),
  (0.493, 834.351, 0.156, 743.193,0.428, 84.101, 1058.062,8.652,  1023,    0.168,  7.101,  8.135,  152.646),



  (118.90,2035.35, 89.35, 15.402, 10.856,110.049,3024.42, 8054.74,5214.36, 5.539,  11.539, 515.632,150.411)
  )

rects=[]
xticks=[]
patterns = (’/’,‘x’, ‘\’,‘o’)

colors=[‘r’,‘b’,‘y’, ‘g’]

fig = figure()
ax=fig.add_subplot(111)

ax.set_yscale(‘log’)
ax.set_ylim(1e-4, 1e5)
width=0.1

for q in range(13):
for n in range(4):

    l = q+width*n
    h = data[n][q]
    w =  width
    rect, = ax.bar(l, h, w, bottom=0, fill=False, hatch=patterns[n], log=True)

draw()

Try without bottom=0 in ax.bar. Also you don’t need ax.set_yscale(‘log’) in the first place. How did you get something seen on your screen without show() in the end?

···

On Thu, Feb 25, 2010 at 8:56 AM, afancy <groupme@…1896…> wrote:


Download Intel® Parallel Studio Eval

Try the new software tools for yourself. Speed compiling, find bugs

proactively, and fine-tune applications for parallel performance.

See why Intel Parallel Studio got high marks during beta.

http://p.sf.net/sfu/intel-sw-dev


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Gökhan

Hi

if I replace
  bottom=0
with
  bottom=10**-3
in your script I see bars.

Kind regards,
Matthias Michler

···

On Thursday 25 February 2010 15:56:31 afancy wrote:

Hi,

I have some difficulty to use the log scale on bar chart. Could anybody
help me, thanks in advace.

Regards,
afancy

from matplotlib.font_manager import FontProperties
data=((0.014, 0.512, 0.015, 0.161, 1.177, 6.793, 0.089, 1.495,
25.65, 0.014, 0.045, 0.052, 5.423),
      (0.529, 0.612, 0.855, 0.178, 1.432, 6.43, 41.311, 1.62,
71.012, 1.59, 0.271, 0.066, 4.721),
      (0.493, 834.351, 0.156, 743.193,0.428, 84.101, 1058.062,8.652,
1023, 0.168, 7.101, 8.135, 152.646),
      (118.90,2035.35, 89.35, 15.402, 10.856,110.049,3024.42,
8054.74,5214.36, 5.539, 11.539, 515.632,150.411)
      )

rects=[]
xticks=[]
patterns = ('/','x', '\\','o')
colors=['r','b','y', 'g']

fig = figure()
ax=fig.add_subplot(111)

ax.set_yscale('log')
ax.set_ylim(1e-4, 1e5)
width=0.1

for q in range(13):
    for n in range(4):
        l = q+width*n
        h = data[n][q]
        w = width
        rect, = ax.bar(l, h, w, bottom=0, fill=False, hatch=patterns[n],
log=True)

draw()