This repository has been archived by the owner on Jul 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
backends_and_output.html
21 lines (19 loc) · 17.5 KB
/
backends_and_output.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Backends & Output · Makie Plotting Ecosystem</title><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script><link href="assets/favicon.ico" rel="icon" type="image/x-icon"/><link href="assets/syntaxtheme.css" rel="stylesheet" type="text/css"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Makie Plotting Ecosystem logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Makie Plotting Ecosystem</a></span></div><form class="docs-search" action="search.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="index.html">Home</a></li><li><span class="tocitem">Basics</span><ul><li><a class="tocitem" href="basic-tutorial.html">Basic Tutorial</a></li><li><a class="tocitem" href="makielayout/tutorial.html">Layout Tutorial</a></li><li><a class="tocitem" href="animation.html">Animations</a></li><li><a class="tocitem" href="interaction.html">Observables & Interaction</a></li><li><input class="collapse-toggle" id="menuitem-2-5" type="checkbox"/><label class="tocitem" for="menuitem-2-5"><span class="docs-label">Plotting Functions</span><i class="docs-chevron"></i></label><ul class="collapsed"><li><a class="tocitem" href="plotting_functions/arrows.html">arrows</a></li><li><a class="tocitem" href="plotting_functions/band.html">band</a></li><li><a class="tocitem" href="plotting_functions/barplot.html">barplot</a></li><li><a class="tocitem" href="plotting_functions/contour.html">contour</a></li><li><a class="tocitem" href="plotting_functions/contourf.html">contourf</a></li><li><a class="tocitem" href="plotting_functions/density.html">density</a></li><li><a class="tocitem" href="plotting_functions/errorbars.html">errorbars</a></li><li><a class="tocitem" href="plotting_functions/heatmap.html">heatmap</a></li><li><a class="tocitem" href="plotting_functions/hist.html">hist</a></li><li><a class="tocitem" href="plotting_functions/image.html">image</a></li><li><a class="tocitem" href="plotting_functions/lines.html">lines</a></li><li><a class="tocitem" href="plotting_functions/linesegments.html">linesegments</a></li><li><a class="tocitem" href="plotting_functions/mesh.html">mesh</a></li><li><a class="tocitem" href="plotting_functions/meshscatter.html">meshscatter</a></li><li><a class="tocitem" href="plotting_functions/poly.html">poly</a></li><li><a class="tocitem" href="plotting_functions/rangebars.html">rangebars</a></li><li><a class="tocitem" href="plotting_functions/scatter.html">scatter</a></li><li><a class="tocitem" href="plotting_functions/scatterlines.html">scatterlines</a></li><li><a class="tocitem" href="plotting_functions/stem.html">stem</a></li><li><a class="tocitem" href="plotting_functions/streamplot.html">streamplot</a></li><li><a class="tocitem" href="plotting_functions/surface.html">surface</a></li><li><a class="tocitem" href="plotting_functions/text.html">text</a></li><li><a class="tocitem" href="plotting_functions/volume.html">volume</a></li></ul></li><li><a class="tocitem" href="theming.html">Theming</a></li></ul></li><li><span class="tocitem">Documentation</span><ul><li><a class="tocitem" href="plot_method_signatures.html">Plot Method Signatures</a></li><li><a class="tocitem" href="figure.html">Figure</a></li><li><input class="collapse-toggle" id="menuitem-3-3" type="checkbox"/><label class="tocitem" for="menuitem-3-3"><span class="docs-label">Layoutables & Widgets</span><i class="docs-chevron"></i></label><ul class="collapsed"><li><a class="tocitem" href="makielayout/layoutables.html">Layoutables</a></li><li><a class="tocitem" href="makielayout/axis.html">Axis</a></li><li><a class="tocitem" href="makielayout/axis3.html">Axis3</a></li><li><a class="tocitem" href="makielayout/box.html">Box</a></li><li><a class="tocitem" href="makielayout/button.html">Button</a></li><li><a class="tocitem" href="makielayout/colorbar.html">Colorbar</a></li><li><a class="tocitem" href="makielayout/gridlayout.html">GridLayout</a></li><li><a class="tocitem" href="makielayout/intervalslider.html">IntervalSlider</a></li><li><a class="tocitem" href="makielayout/label.html">Label</a></li><li><a class="tocitem" href="makielayout/legend.html">Legend</a></li><li><a class="tocitem" href="makielayout/lscene.html">LScene</a></li><li><a class="tocitem" href="makielayout/menu.html">Menu</a></li><li><a class="tocitem" href="makielayout/slider.html">Slider</a></li><li><a class="tocitem" href="makielayout/toggle.html">Toggle</a></li></ul></li><li><a class="tocitem" href="makielayout/layouting.html">How layouts work</a></li><li><a class="tocitem" href="generated/colors.html">Colors</a></li><li><a class="tocitem" href="generated/plot-attributes.html">Plot attributes</a></li><li><a class="tocitem" href="recipes.html">Plot Recipes</a></li><li class="is-active"><a class="tocitem" href="backends_and_output.html">Backends & Output</a><ul class="internal"><li><a class="tocitem" href="#[GLMakie](https://github.com/JuliaPlots/GLMakie.jl)"><span>GLMakie</span></a></li><li><a class="tocitem" href="#[CairoMakie](https://github.com/JuliaPlots/CairoMakie.jl)"><span>CairoMakie</span></a></li><li><a class="tocitem" href="#[WGLMakie](https://github.com/JuliaPlots/WGLMakie.jl)"><span>WGLMakie</span></a></li><li><a class="tocitem" href="#Miscellaneous-Tips"><span>Miscellaneous Tips</span></a></li></ul></li><li><a class="tocitem" href="scenes.html">Scenes</a></li><li><a class="tocitem" href="lighting.html">Lighting</a></li><li><a class="tocitem" href="cameras.html">Cameras</a></li><li><a class="tocitem" href="faq.html">Frequently Asked Questions</a></li><li><a class="tocitem" href="abstractplotting_api.html">API Reference AbstractPlotting</a></li><li><a class="tocitem" href="makielayout/reference.html">API Reference MakieLayout</a></li><li><a class="tocitem" href="generated/axis.html">Integrated Axes (Axis2D / Axis3D)</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Documentation</a></li><li class="is-active"><a href="backends_and_output.html">Backends & Output</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="backends_and_output.html">Backends & Output</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://github.com/JuliaPlots/AbstractPlotting.jl/blob/master/docs/src/backends_and_output.md#" title="Edit on GitHub"><span class="docs-icon fab"></span><span class="docs-label is-hidden-touch">Edit on GitHub</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Backends-and-Output"><a class="docs-heading-anchor" href="#Backends-and-Output">Backends & Output</a><a id="Backends-and-Output-1"></a><a class="docs-heading-anchor-permalink" href="#Backends-and-Output" title="Permalink"></a></h1><p>AbstractPlotting is Makie's frontend package that defines all plotting functions. It is reexported by every backend, so you don't have to specifically install or import it.</p><p>There are three main backends which concretely implement all abstract rendering capabilities defined in AbstractPlotting:</p><table><tr><th style="text-align: left">Package</th><th style="text-align: left">Description</th></tr><tr><td style="text-align: left"><a href="https://github.com/JuliaPlots/GLMakie.jl"><code>GLMakie.jl</code></a></td><td style="text-align: left">GPU-powered, interactive 2D and 3D plotting in standalone <code>GLFW.jl</code> windows.</td></tr><tr><td style="text-align: left"><a href="https://github.com/JuliaPlots/CairoMakie.jl"><code>CairoMakie.jl</code></a></td><td style="text-align: left"><code>Cairo.jl</code> based, non-interactive 2D backend for publication-quality vector graphics.</td></tr><tr><td style="text-align: left"><a href="https://github.com/JuliaPlots/WGLMakie.jl"><code>WGLMakie.jl</code></a></td><td style="text-align: left">WebGL-based interactive 2D and 3D plotting that runs within browsers.</td></tr></table><h3 id="Activating-Backends"><a class="docs-heading-anchor" href="#Activating-Backends">Activating Backends</a><a id="Activating-Backends-1"></a><a class="docs-heading-anchor-permalink" href="#Activating-Backends" title="Permalink"></a></h3><p>You can activate any backend by <code>using</code> the appropriate package and calling its <code>activate!</code> function.</p><p>Example with WGLMakie:</p><pre><code class="language-julia">using WGLMakie
WGLMakie.activate!()</code></pre><h2 id="[GLMakie](https://github.com/JuliaPlots/GLMakie.jl)"><a class="docs-heading-anchor" href="#[GLMakie](https://github.com/JuliaPlots/GLMakie.jl)"><a href="https://github.com/JuliaPlots/GLMakie.jl">GLMakie</a></a><a id="[GLMakie](https://github.com/JuliaPlots/GLMakie.jl)-1"></a><a class="docs-heading-anchor-permalink" href="#[GLMakie](https://github.com/JuliaPlots/GLMakie.jl)" title="Permalink"></a></h2><p>GLMakie is the native, desktop-based backend, and is the most feature-complete. It requires an OpenGL enabled graphics card with OpenGL version 3.3 or higher.</p><h3 id="Special-GLMakie-Properties"><a class="docs-heading-anchor" href="#Special-GLMakie-Properties">Special GLMakie Properties</a><a id="Special-GLMakie-Properties-1"></a><a class="docs-heading-anchor-permalink" href="#Special-GLMakie-Properties" title="Permalink"></a></h3><h4 id="Window-Parameters"><a class="docs-heading-anchor" href="#Window-Parameters">Window Parameters</a><a id="Window-Parameters-1"></a><a class="docs-heading-anchor-permalink" href="#Window-Parameters" title="Permalink"></a></h4><p>You can set parameters of the window with the function <code>set_window_config!</code> which only takes effect when opening a new window.</p><pre><code class="language-julia">set_window_config!(;
renderloop = renderloop,
vsync = false,
framerate = 30.0,
float = false,
pause_rendering = false,
focus_on_show = false,
decorated = true,
title = "Makie"
)</code></pre><h2 id="[CairoMakie](https://github.com/JuliaPlots/CairoMakie.jl)"><a class="docs-heading-anchor" href="#[CairoMakie](https://github.com/JuliaPlots/CairoMakie.jl)"><a href="https://github.com/JuliaPlots/CairoMakie.jl">CairoMakie</a></a><a id="[CairoMakie](https://github.com/JuliaPlots/CairoMakie.jl)-1"></a><a class="docs-heading-anchor-permalink" href="#[CairoMakie](https://github.com/JuliaPlots/CairoMakie.jl)" title="Permalink"></a></h2><p>CairoMakie uses Cairo.jl to draw vector graphics to SVG and PDF. You should use it if you want to achieve the highest-quality plots for publications, as the rendering process of the GL backends works via bitmaps and is geared more towards speed than pixel-perfection.</p><h3 id="Special-CairoMakie-Properties"><a class="docs-heading-anchor" href="#Special-CairoMakie-Properties">Special CairoMakie Properties</a><a id="Special-CairoMakie-Properties-1"></a><a class="docs-heading-anchor-permalink" href="#Special-CairoMakie-Properties" title="Permalink"></a></h3><h4 id="Inline-Plot-Type"><a class="docs-heading-anchor" href="#Inline-Plot-Type">Inline Plot Type</a><a id="Inline-Plot-Type-1"></a><a class="docs-heading-anchor-permalink" href="#Inline-Plot-Type" title="Permalink"></a></h4><p>You can choose the type of plot that is displayed inline in, e.g., VSCode, Pluto.jl, or any other environment, by setting it via the <code>activate!</code> function.</p><pre><code class="language-julia">CairoMakie.activate!(type = "png")
CairoMakie.activate!(type = "svg")</code></pre><h4 id="Resolution-Scaling"><a class="docs-heading-anchor" href="#Resolution-Scaling">Resolution Scaling</a><a id="Resolution-Scaling-1"></a><a class="docs-heading-anchor-permalink" href="#Resolution-Scaling" title="Permalink"></a></h4><p>When you save a CairoMakie figure, you can change the mapping from figure resolution to pixels (when saving to png) or points (when saving to svg or pdf). This way you can easily scale the resulting image up or down without having to change any plot element sizes.</p><p>Just specify <code>pt_per_unit</code> when saving vector formats and <code>px_per_unit</code> when saving pngs. Both default to 1.</p><p>Here's an example:</p><pre><code class="language-julia">fig = Figure(resolution = (800, 600))
save("normal.pdf", fig) # size = 800 x 600 pt
save("larger.pdf", fig, pt_per_unit = 2) # size = 1600 x 1200 pt
save("smaller.pdf", fig, pt_per_unit = 0.5) # size = 400 x 300 pt
save("normal.png", fig) # size = 800 x 600 px
save("larger.png", fig, px_per_unit = 2) # size = 1600 x 1200 px
save("smaller.png", fig, px_per_unit = 0.5) # size = 400 x 300 px</code></pre><h4 id="Z-Order"><a class="docs-heading-anchor" href="#Z-Order">Z-Order</a><a id="Z-Order-1"></a><a class="docs-heading-anchor-permalink" href="#Z-Order" title="Permalink"></a></h4><p>CairoMakie as a 2D engine has no concept of z-clipping, therefore its 3D capabilities are quite limited. The z-values of 3D plots will have no effect and will be projected flat onto the canvas. Z-layering is approximated by sorting all plot objects by their z translation value before drawing, after that by parent scene and then insertion order. Therefore, if you want to draw something on top of something else, but it ends up below, try translating it forward via <code>translate!(obj, 0, 0, some_positive_z_value)</code>.</p><h2 id="[WGLMakie](https://github.com/JuliaPlots/WGLMakie.jl)"><a class="docs-heading-anchor" href="#[WGLMakie](https://github.com/JuliaPlots/WGLMakie.jl)"><a href="https://github.com/JuliaPlots/WGLMakie.jl">WGLMakie</a></a><a id="[WGLMakie](https://github.com/JuliaPlots/WGLMakie.jl)-1"></a><a class="docs-heading-anchor-permalink" href="#[WGLMakie](https://github.com/JuliaPlots/WGLMakie.jl)" title="Permalink"></a></h2><p>WGLMakie is the Web-based backend, and is still experimental (though relatively feature-complete). Only serving it on a webpage or in Pluto.jl / Ijulia are currently supported. VSCode integration should come soon.</p><h2 id="Miscellaneous-Tips"><a class="docs-heading-anchor" href="#Miscellaneous-Tips">Miscellaneous Tips</a><a id="Miscellaneous-Tips-1"></a><a class="docs-heading-anchor-permalink" href="#Miscellaneous-Tips" title="Permalink"></a></h2><h3 id="Forcing-Dedicated-GPU-Use-In-Linux"><a class="docs-heading-anchor" href="#Forcing-Dedicated-GPU-Use-In-Linux">Forcing Dedicated GPU Use In Linux</a><a id="Forcing-Dedicated-GPU-Use-In-Linux-1"></a><a class="docs-heading-anchor-permalink" href="#Forcing-Dedicated-GPU-Use-In-Linux" title="Permalink"></a></h3><p>Normally the dedicated GPU is used for rendering. If instead an integrated GPU is used, one can tell Julia to use the dedicated GPU while launching julia as <code>$ sudo DRI_PRIME=1 julia</code> in the bash terminal.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="recipes.html">« Plot Recipes</a><a class="docs-footer-nextpage" href="scenes.html">Scenes »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Thursday 22 April 2021 08:15">Thursday 22 April 2021</span>. Using Julia version 1.6.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>