GithubHelp home page GithubHelp logo

Comments (5)

cormullion avatar cormullion commented on May 18, 2024

The code can be improved (JunoLab/Juno.jl#58) by adding a browser-fooling URL:

using Luxor
using Juno, Hiccup
Juno.media(MyType, Media.Plot)
Juno.media(MyType, Media.Graphical)

function Juno.render(pane::Juno.PlotPane, img::Drawing)
    Juno.render(pane, Hiccup.div(Hiccup.img(src=img.filename*"?$(time())")))
end

cd("/tmp")
Drawing("A6", "/tmp/t17.png")
background("grey20")
origin()
randomhue()
R = rand(30:63)
epitrochoid(R, rand(12:41), rand(5:137), :stroke)
fontsize(70)
sethue("white")
text(string(R))
finish()
display(currentdrawing)

screen shot 2017-05-16 at 10 37 46

This might be added to the Luxor package one day, perhaps when there are conditional dependencies (i.e. "load this code only if Juno is available".

from luxor.jl.

pfitzseb avatar pfitzseb commented on May 18, 2024

Okay, so our design idea here was that you'll only need to depend on Juno, which is super small and lightweight (because it and all it's dependecies are pure Julia) and can then call Juno.isactive() as a guard around your render definitions.
This approach shouldn't add much overhead, but still work around the conditional requirements issue. Still, it's of course up to you if you want to support native Juno plotting right now :)

from luxor.jl.

cormullion avatar cormullion commented on May 18, 2024

Oh, it's easier than I thought... ! I'll have a crack at it today or tomorrow!

from luxor.jl.

pfitzseb avatar pfitzseb commented on May 18, 2024

Great :)
Btw, you don't even need to save the svg to a file -- dumping the svg contents into the plot pane directly works too.

from luxor.jl.

cormullion avatar cormullion commented on May 18, 2024

Added code to support Juno in this commit, see how it works...

from luxor.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.