Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Log scale plots raise warning and break subsequent non-log scale plots #3918

Closed
ConnectedSystems opened this issue Nov 2, 2021 · 1 comment · Fixed by JuliaPlots/PlotUtils.jl#124
Labels

Comments

@ConnectedSystems
Copy link

ConnectedSystems commented Nov 2, 2021

Details

Plots break when iteratively building mix of log scale and non-log scale plots.

In the initial plot, it seems to display okay except the tick/tick labels are missing.

There are some related issues already (mostly closed) but I am still experiencing this issue.

#3790
#2309
#920
JuliaPlots/PlotUtils.jl#116

Unlike in this discussion, there is no 0s in the data (as shown in example below)
https://discourse.julialang.org/t/no-strict-ticks-found-message/45217/6

As far as I can determine, it's something to do with the range of values being used
Simple example case (breaking y-axis tick labels):

using Plots

# This is fine
fig = plot([1:25], yscale=:log10)

# This is not fine
fig = plot([5:25], yscale=:log10)
┌ Warning: No strict ticks found
└ @ PlotUtils C:\Users\Takuya\.julia\packages\PlotUtils\VgXdq\src\ticks.jl:294
┌ Warning: No strict ticks found
└ @ PlotUtils C:\Users\Takuya\.julia\packages\PlotUtils\VgXdq\src\ticks.jl:294

This is especially an issue in my case as I am building a mix of regular and log scale plots in a loop.

Additionally, I believe there is some global value being erroneously set or something similar, as once it breaks, all subsequent plots are affected.

My tentative and inelegant fix is to extend the x_max and x_min values to the ceil and floor respectively, as shown in the link below

https://github.com/ConnectedSystems/PlotUtils.jl/blob/cfbbd511b278e7f90ca27ce17b90de240d099aad/src/ticks.jl#L159

Backends

GR

This bug occurs on ( insert x below )

Backend yes no untested
gr (default) x
pyplot x
plotlyjs x
pgfplotsx x
unicodeplots x
inspectdr x
gaston x

Versions

Plots.jl version: v1.23.2
Backend version (]st -m <backend(s)>): GR v0.61.0
Output of versioninfo():

Julia Version 1.5.4
Commit 69fcb5745b (2021-03-11 19:13 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: AMD Ryzen Threadripper 2990WX 32-Core Processor
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, znver1)

@ConnectedSystems ConnectedSystems changed the title [BUG] [BUG] Log scale plots raise warning and break subsequent non-log scale plots Nov 2, 2021
@ConnectedSystems
Copy link
Author

ConnectedSystems commented Nov 2, 2021

A more complex example

fig1 = plot([6:26])
plot!(fig1, [5:26])

fig2 = plot([6:26], yscale=:log10)
fig3 = plot([10:27], yscale=:log10)

combined_log = plot(fig2, fig3, link=:y)

# This displays incorrectly
plot(fig1, combined_log, layout=(2,1), link=:none)

Without hacky fix above:

image

With hacky fix:

image

Note that the y-axis labels for the bottom two plots seem to extend "off screen", visible in this example as it has another figure on top.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants