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

Have IJulia honor set_default_plot_format #1529

Open
knuesel opened this issue Mar 31, 2021 · 4 comments
Open

Have IJulia honor set_default_plot_format #1529

knuesel opened this issue Mar 31, 2021 · 4 comments

Comments

@knuesel
Copy link

knuesel commented Mar 31, 2021

It would be nice if set_default_plot_format(:png) was working in IJulia. Not sure if this is a bug or feature request.

@Mattriks
Copy link
Member

Mattriks commented Mar 31, 2021

There's an example on Julia Discourse of one way to enable set_default_plot_format. I haven't tested that out on IJulia. Note IJulia creates it's own display, at the top of the display stack:

using Gadfly
import Base.Multimedia as mltm

# display stack:
mltm.display

3-element Vector{AbstractDisplay}:
 TextDisplay(Base.TTY(Base.Libc.WindowsRawSocket(0x0000000000000278) open, 0 bytes waiting))
 Gadfly.GadflyDisplay()
 IJulia.InlineDisplay()

as does VScode. Gadfly shouldn't override those displays by default e.g. see #1311. You may have to popdisplay() to get the discourse example working in IJulia.

@knuesel
Copy link
Author

knuesel commented Apr 2, 2021

Thanks for the link, I couldn't figure out how to make set_default_plot_format do anything.

I was expecting something like in Plots.jl, where you can do plot(..., fmt=:png) to show a specific plot as PNG, or default(fmt=:png) to change the format of all plots. For the user this "just works" in IJulia without fiddling with displays.

It seems that Plots.jl does it by overloading IJulia.display_dict, see here and here. Maybe more a hack than a proper solution...

@Mattriks
Copy link
Member

Mattriks commented Apr 2, 2021

I can't tell from your posts if you have found (for a specific Gadfly plot):

p = plot(...)
draw(PNG(8inch, 8inch), p)

@knuesel
Copy link
Author

knuesel commented Apr 3, 2021

Yes, in IJulia I'm currently using plot(...) |> PNG() which works fine but must be done for each plot. So it would be nice to have an easy way to change the default, and there's already set_default_plot_format which doesn't do much currently. But maybe the Plots.jl way is not the right way and the default should be set through IJulia rather than Gadfly...

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

No branches or pull requests

2 participants