Skip to content

Commit

Permalink
Add an example of using rasterize (#1919)
Browse files Browse the repository at this point in the history
* example for rasterize use.
* Add random points to the Figure
* Add a hard example of changing rasterization sizes

Co-authored-by: alex <awage>
Co-authored-by: Simon <[email protected]>
Co-authored-by: Anshul Singhvi <[email protected]>
  • Loading branch information
3 people authored May 12, 2022
1 parent 3f87809 commit 3a3d7c2
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/documentation/backends/cairomakie.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,26 @@ Assuming that you have a `Plot` object `plt`, you can set `plt.rasterize = true`
For example, if your Scene's resolution is `(800, 600)`, by setting `scale=2`, the rasterized image will have a resolution of `(1600, 1200)`.

You can deactivate this rasterization by setting `plt.rasterize = false`.

Example:

\begin{examplefigure}{svg=true}
```julia
using CairoMakie
CairoMakie.activate!() # hide
v = rand(10,2)
scatter(v[:,1], v[:,2], rasterize = true, markersize = 30.0)
```
\end{examplefigure}

If you zoom in, you will see a pretty badly pixelated image - this is because the rasterization density is set to 1 `px` per `pt`. Setting `rasterize=10` makes this a lot smoother:

\begin{examplefigure}{svg=true}
```julia
using CairoMakie
CairoMakie.activate!() # hide
v = rand(10,2)
scatter(v[:,1], v[:,2], rasterize = 10, markersize = 30.0)
```
\end{examplefigure}

0 comments on commit 3a3d7c2

Please sign in to comment.