-
-
Notifications
You must be signed in to change notification settings - Fork 372
Closed
Description
I think this is a very similar issue to #920 and #455.
When I try to use yscale=:log10 with negative numbers involved, than plotting fails. Is this to be expected?
I expected that the negative yaxis also could be scaled to log10.
julia> using Plots
julia> y = cumsum(randn(1000))
1000-element Array{Float64,1}:
1.8348617340698719
1.9606676421249605
4.333292609221781
4.09586047315016
2.98930280831738
2.357884780473308
2.6189274704623235
2.83913285661845
4.344737082863868
4.763790453265313
7.7348590368246235
6.200257461690212
7.013165122758999
⋮
52.712163269110924
52.068582279483046
53.78077131388864
53.11248976727025
52.746426694762135
52.0656869461403
52.80934531825999
52.79565060643303
52.97480165785222
52.36469731394966
51.51959490723907
53.491865989913464
julia> plot(y, label="data", yscale=:log10)julia> y = cumsum(randn(1000))
1000-element Array{Float64,1}:
1.6817492628520394
0.3680270914647106
-1.2270393491574023
-1.5711404626304561
-0.5348526196816741
-0.8200693718466388
0.39696492411542406
0.08383529336848139
-1.134012164398457
-1.6296405703629382
-1.0146955231435941
-0.5772690171903598
-0.15132812426836884
⋮
37.10157525765415
36.023787355352816
35.17354783593564
36.08233783147756
35.803529277885154
35.337439611497885
34.62101719705245
34.330446662122334
34.882637867410864
34.22854522933675
35.754676632885015
35.52025132181647
julia> plot(y, label="data", yscale=:log10)
Error showing value of type Plots.Plot{Plots.GRBackend}:
ERROR: DomainError with -28.45252942385645:
NaN result for non-NaN input.
Stacktrace:
[1] nan_dom_err at ./math.jl:339 [inlined]
[2] log10(::Float64) at ./math.jl:485
[3] (::getfield(Plots, Symbol("##106#107")){Symbol})(::Float64) at /home/sebastian/.julia/packages/Plots/UQI78/src/axes.jl:151
[4] widen(::Float64, ::Float64, ::Symbol) at /home/sebastian/.julia/packages/Plots/UQI78/src/axes.jl:451
[5] axis_limits(::Plots.Axis, ::Bool) at /home/sebastian/.julia/packages/Plots/UQI78/src/axes.jl:510
[6] axis_limits at /home/sebastian/.julia/packages/Plots/UQI78/src/axes.jl:483 [inlined]
[7] axis_drawing_info(::Plots.Subplot{Plots.GRBackend}) at /home/sebastian/.julia/packages/Plots/UQI78/src/axes.jl:590
[8] _update_min_padding!(::Plots.Subplot{Plots.GRBackend}) at /home/sebastian/.julia/packages/Plots/UQI78/src/backends/gr.jl:584
[9] iterate at ./generator.jl:47 [inlined]
[10] _collect(::Array{AbstractLayout,2}, ::Base.Generator{Array{AbstractLayout,2},typeof(Plots._update_min_padding!)}, ::Base.EltypeUnknown, ::Base.HasShape{2}) at ./array.jl:619
[11] collect_similar at ./array.jl:548 [inlined]
[12] map at ./abstractarray.jl:2018 [inlined]
[13] _update_min_padding!(::Plots.GridLayout) at /home/sebastian/.julia/packages/Plots/UQI78/src/layouts.jl:310
[14] prepare_output(::Plots.Plot{Plots.GRBackend}) at /home/sebastian/.julia/packages/Plots/UQI78/src/plot.jl:261
[15] display(::Plots.PlotsDisplay, ::Plots.Plot{Plots.GRBackend}) at /home/sebastian/.julia/packages/Plots/UQI78/src/output.jl:144
[16] display(::Any) at ./multimedia.jl:287
[17] #invokelatest#1 at ./essentials.jl:742 [inlined]
[18] invokelatest at ./essentials.jl:741 [inlined]
[19] print_response(::IO, ::Any, ::Any, ::Bool, ::Bool, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:155
[20] print_response(::REPL.AbstractREPL, ::Any, ::Any, ::Bool, ::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:140
[21] (::getfield(REPL, Symbol("#do_respond#38")){Bool,getfield(REPL, Symbol("##48#57")){REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:714
[22] #invokelatest#1 at ./essentials.jl:742 [inlined]
[23] invokelatest at ./essentials.jl:741 [inlined]
[24] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/LineEdit.jl:2273
[25] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:1035
[26] run_repl(::REPL.AbstractREPL, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:192
[27] (::getfield(Base, Symbol("##734#736")){Bool,Bool,Bool,Bool})(::Module) at ./client.jl:362
[28] #invokelatest#1 at ./essentials.jl:742 [inlined]
[29] invokelatest at ./essentials.jl:741 [inlined]
[30] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:346
[31] exec_options(::Base.JLOptions) at ./client.jl:284
[32] _start() at ./client.jl:436xiuliren, sallyseal, mcabbott, thomas9t, spirosbax and 3 more
Metadata
Metadata
Assignees
Labels
No labels
