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][UnicodePlotsBackend] showable for image/png and UnicodePlotsBackend is unreliable #4956

Open
david-macmahon opened this issue Jul 4, 2024 · 1 comment

Comments

@david-macmahon
Copy link
Contributor

Details

Displaying plots made by the UnicodePlots backend of Plots.jl throws an argument error in VS Code. The underlying cause is because showable for image/png and UnicodePlotsBackend (always) returns true, even when UnicodePlots.save_image has zero methods. The exact method call that (always) returns true:

showable(MIME("image/png"), Plots.Plot{Plots.UnicodePlotsBackend})

Defining the following showable method avoids this problem and Plots.jl plots made with the UnicodePlotsBackend display properly inline in the REPL.

Base.showable(::MIME"image/png", ::Plots.Plot{Plots.UnicodePlotsBackend}) = applicable(UnicodePlots.save_image, devnull)

Backends

This bug is specific to UnicodePlotsBackend.

Backend yes no untested
unicodeplots x

Versions

Plots.jl version: Plots v1.40.4
Backend version: UnicodePlots v3.6.4
Output of versioninfo():

julia> versioninfo()
Julia Version 1.10.4
Commit 48d4fd48430 (2024-06-04 10:41 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 8 × Apple M2
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)
@t-bltg
Copy link
Member

t-bltg commented Oct 15, 2024

The exact method call that (always) returns true:

showable(MIME("image/png"), Plots.Plot{Plots.UnicodePlotsBackend})

Where do you see this method ?

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

No branches or pull requests

3 participants