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

Display in Juno #902

Merged
merged 2 commits into from
Sep 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ KernelDensity
Loess
Showoff 0.0.3
StatsBase
Juno
18 changes: 17 additions & 1 deletion src/Gadfly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Creates layers based on elements

### Args
* data_source: The data source as a dataframe
* elements: The elements
* elements: The elements
* mapping: mapping

### Returns
Expand Down Expand Up @@ -1105,6 +1105,22 @@ function display(d::REPLDisplay, ::MIME"application/pdf", p::Plot)
open_file(filename)
end

# Display in Juno

import Juno: Juno, @render, media, Media, Hiccup
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are Media and Hiccup going to be dependencies of every version of Juno that will ever be released? if not, better to depend on then explicitly instead of importing them indirectly like this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indirect dependency on Media adds a dependency on Requires which is one of the known-to-be-unreliable conditional dependency workarounds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the idea is that the Media and Hiccup submodules form part of Juno.jl's public API. If that changes it can be handled in the standard way.

The whole point of this PR is to enable Requires.jl to be removed from Media.jl, and from the rest of Atom.jl's dependency tree.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah that would be great

Copy link

@ChrisRackauckas ChrisRackauckas Sep 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @pfitzseb, something like in the Juno stack may have been the cause of the v0.5 upgrade precompilation error seen last night. Not this specifically, but if you used the same conditional dependency workaround somewhere else, it would lead to t and be fixed by the fix in the fix found in the issue:

JunoLab/uber-juno#15


media(Plot, Media.Plot)

@render Juno.PlotPane p::Plot begin
x, y = Juno.plotsize()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like much of the rest of gadfly uses 4 space indent

set_default_plot_size(x*Gadfly.px, y*Gadfly.px)
Hiccup.div(Dict(:style=>"background: white"),
HTML(stringmime("text/html", p)))
end

@render Juno.Editor p::Gadfly.Plot begin
Juno.icon("graph")
end

include("scale.jl")
include("coord.jl")
Expand Down