ValueError: math domain error

Your code is doing a log of a number that is less than or equal to zero. That’s mathematically undefined, so Python’s log function raises an exception. Here’s an example: >>> from math import log >>> log(-1) Traceback (most recent call last): File “<pyshell#59>”, line 1, in <module> log(-1) ValueError: math domain error Without knowing … Read more

Histogram with Logarithmic Scale and custom breaks

A histogram is a poor-man’s density estimate. Note that in your call to hist() using default arguments, you get frequencies not probabilities — add ,prob=TRUE to the call if you want probabilities. As for the log axis problem, don’t use ‘x’ if you do not want the x-axis transformed: plot(mydata_hist$count, log=”y”, type=”h”, lwd=10, lend=2) gets … Read more