I want to plot some data that contains zeros, with log-axes. This does not work easily:
using Plots
xs=[0.0,1.0,2.0]; ys=xs.^2;
plot(xs,ys; xaxis=:log)
#ArgumentError: At least one finite value must be provided to formatter.
The same for data with infinite values (which is the core issue).
Now, what is the kind of output I’d like? Well, infinite values like log(0.0)=-Inf
should get a point to the left/right/above/below that smallest/largest finite value that occurs, and I’d ideally get an extra labled tick and an axis break for this.
Apart from the nice axes/ticks, this can be achieved by iterating over the data, computing the smallest/largest finite values, computing a threshold that is somewhat below/above and truncating the infinite values. However, the correct transformation depends on which axes are supposed to be logarithmic, and which ones are supposed to be absolute; so it is really the plot function that should do this transformation.
Why do I want this? First, logarithmic plots with zeros. Second, beyond-threshold sometimes wants to be represented as infinity. E.g. when plotting run-times of algorithms, it is quite sensible to represent out-of-memory as infinity.
So my question is, 1. does there exist a plot option for this? 2. If not, is there a recipe flying around for this?