Hello! So, my goal with this code is to plot the BR COVID-19 data with a logaritmic scale in y axis. The problem is, it keeps saying that there is an Argument Error and at least one finite value must be provided to formatter.
plot(dates, br_data, xticks=dates[1:30:300], xrotation=45,
leg=:topleft, label="BR Data", m=:o,
yscale=:log10)
xlabel!("Date")
ylabel!("Confirmed cases in BR")
title!("BR confirmed COVID-19 cases")
But I can’t manage to see what that I am passing is infinite and is causing the trouble. I’m using Julia 1.0.4!
It would be helpful (necessary) to provide more info about what you are plotting. Not everyone is familiar with this dataset.
A useful starting point would be to subset the data to a manageable size. Then inspect that data in the REPL. Then plot the subset and see if the error persists. Then expand the until the error occurs.
Does the same error occur without logs?
plot([1,10,0,2,200], yaxis=:log10, ylim=[0.3,300])
should work, and simply skip the 3rd point since log(0) == -Inf
. (But if you have a sufficiently ancient installation of Plots, it may fail.)
If you remove ylim
, then you will get the error you describe, because the logic which decides on the range and the ticks doesn’t like this infinity. But deleting that point will let it auto-set the range again: plot([1,10,2,200], yaxis=:log10)
works.
1 Like