Skip to content

Bug in bar plot, leading zeros in data (bar heights) are ignored. #2150

Closed
@danieljfarrell

Description

@danieljfarrell

The bar plot function seems to ignore bar heights that are zero. For example, the data set called "freq1" does not contain a leading zero and the bar heights are correct. The data set "freq2" contains a leading zeros, both of which are ignored in the bar plot.

import pylab 
import numpy as np
faces = np.array(range(11)) # the histogram bin faces
left_face = faces[:-1]     # the left side face of the cell
bin_width = faces[1:]-faces[:-1]
freq1 = [-2,0,3,4,5,6,7,8,9,12]
freq2 = [0,0,3,4,5,6,7,8,9,12] # error with this data set
pylab.bar(left_face, freq1, width=bin_width)
pylab.show()
pylab.bar(left_face, freq2, width=bin_width)
pylab.show()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions