Coder Social home page Coder Social logo

cairomakie.jl's Introduction

CairoMakie

The Cairo Backend for Makie

CI codecov

Usage

To add CairoMakie to your environment, simply run the following in the REPL:

]add CairoMakie

If you are using CairoMakie and GLMakie together, you can use each backend's activate! function to switch between them.

GLMakie.activate!()
# use GLMakie interactively
CairoMakie.activate!()
# save the scene as a vector graphic

Issues

Please file all issues in Makie.jl, and mention CairoMakie in the issue text.

Limitations

CairoMakie is intended as a backend for static vector graphics at publication quality. Therefore, it does not support the interactive features of GLMakie and is slower when visualizing large amounts data. 3D plots are currently not available because of the inherent limitations of 2D vector graphics.

Saving

Makie overloads the FileIO interface, so you can save a Scene scene as save("filename.extension", scene). CairoMakie supports saving to PNG, PDF, SVG and EPS.

You can scale the size of the output figure, without changing its appearance by passing keyword arguments to save. PNGs can be scaled by px_per_unit (default 1) and vector graphics (SVG, PDF, EPS) can be scaled by pt_per_unit.

save("plot.svg", scene, pt_per_unit = 0.5) # halve the dimensions of the resulting SVG
save("plot.png", scene, px_per_unit = 2) # double the resolution of the resulting PNG

Using CairoMakie with Gtk.jl

You can render onto a GtkCanvas using Gtk, and use that as a display for your scenes.

using Gtk, CairoMakie, AbstractPlotting

canvas = @GtkCanvas()
window = GtkWindow(canvas, "Makie", 500, 500)

function drawonto(canvas, scene)
    @guarded draw(canvas) do _
       resize!(scene, Gtk.width(canvas), Gtk.height(canvas))
       screen = CairoMakie.CairoScreen(scene, Gtk.cairo_surface(canvas), getgc(canvas), nothing)
       CairoMakie.cairo_draw(screen, scene)
    end
end

scene = heatmap(rand(50, 50)) # or something

drawonto(canvas, scene)
show(canvas); # trigger rendering

cairomakie.jl's People

Contributors

asinghvi17 avatar ericphanson avatar ffreyer avatar github-actions[bot] avatar jkrumbiegel avatar juliatagbot avatar piever avatar simondanisch avatar timholy avatar

Watchers

 avatar  avatar

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.