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

preview and save svg #25

Open
kongdd opened this issue Jul 24, 2024 · 1 comment
Open

preview and save svg #25

kongdd opened this issue Jul 24, 2024 · 1 comment

Comments

@kongdd
Copy link

kongdd commented Jul 24, 2024

In the following example, nothing was displayed, and no any output.
Could you give some guide about how to preview and save svg?

using Karnak
using Graphs
using Colors
g = barabasi_albert(100, 1)
@drawsvg begin
    background("black")
    sethue("grey40")
    fontsize(8)
    drawgraph(g, 
        layout=stress, 
        vertexlabels = 1:nv(g),
        vertexfillcolors = 
            [RGB(rand()/2, rand()/2, rand()/2) 
               for i in 1:nv(g)]
    )
end 600 400
# Luxor drawing: (type = :svg, width = 600.0, height = 400.0, location = in memory)

image

@cormullion
Copy link
Owner

Hi there! You're running in a terminal, which can't display any graphical output. When you run in an environment with graphical capabilities, the SVG source returned by @drawsvg will display in a Plots window or in the notebook environment itself. The text-only representation of a Luxor drawing is Luxor drawing: (type = :svg, width = 600.0, height = 400.0, location = in memory).

Karnak is built on Luxor, so for everything except the drawgraph() function and graphing features, you should refer to the little Luxor manual. The section on Creating Drawings is probably a useful source of information.

Happy reading!

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