0

I am working on a project of pedestrian detection. Here I need to implement HOG from scratch. So I went through a github and tried to implement a script. When implementing I found some errors as follow. As i am a beginner I can not quite understand the problem. Please help me out please.

matplotlib.pyplot.bar(left=numpy.arange(9), height=HOG_cell_hist, align="center", width=0.8)

The above code shows an error message like this-

TypeError: bar() missing 1 required positional argument: 'x'

How to fix this?

Rajan Sharma
  • 2,211
  • 3
  • 21
  • 33

1 Answers1

0

If you take a look to the documentation of the bar function you will see:

matplotlib.pyplot.bar(x, height, width=0.8, bottom=None, *, align='center', data=None, **kwargs)

This tells you that the parameters x and height are not optional. Also, I do not see any left parameters which is used in your code.

I think left should be x and your code will be fixed. Unless you intended something else with the left argument.

The code should be like this:

matplotlib.pyplot.bar(x=numpy.arange(9), height=HOG_cell_hist, align="center", width=0.8)
api55
  • 11,070
  • 4
  • 41
  • 57
  • @ImportanceOfBeingErnest AFAIK I cannot turned them named, but I can use them as named ones, without leaving any positional ones unused, like in [this answer](https://stackoverflow.com/questions/9450656/positional-argument-v-s-keyword-argument) or am I wrong? – api55 Jul 09 '19 at 12:14
  • Oh yes you can. Sorry for the confusion. It's indeed `bar(x, height)`, and I got confused because for `plot` that wouldn't work. Feel free to restore the original answer. – ImportanceOfBeingErnest Jul 09 '19 at 12:17