Skip to content

Commit

Permalink
Merge branch 'master' into sd/wgl-lines
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch authored Aug 8, 2023
2 parents 2b2cc59 + f3f34d0 commit 702a6bc
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 30 deletions.
61 changes: 43 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@
<source media="(prefers-color-scheme: dark)"
srcset="/assets/makie_logo_canvas_dark.svg" >
<img alt="Makie.jl logo"
src="/assets/makie_logo_canvas.svg" width="400">
src="/assets/makie_logo_canvas.svg" width="250">
</picture>
</div>

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/MakieOrg/Makie.jl/blob/main/LICENSE)
[![][docs-stable-img]][docs-stable-url] [![][docs-master-img]][docs-master-url]
[![Build Status](https://github.com/MakieOrg/Makie.jl/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/MakieOrg/Makie.jl/actions/workflows/ci.yml?query=branch%3Amaster)
[![](https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Follow%20%40MakiePlots)](https://twitter.com/MakiePlots)
[![Downloads](https://shields.io/endpoint?url=https://pkgs.genieframework.com/api/v1/badge/Makie&label=Downloads)](https://pkgs.genieframework.com?packages=Makie)

From the japanese word [_Maki-e_](https://en.wikipedia.org/wiki/Maki-e), which is a technique to sprinkle lacquer with gold and silver powder.
Data is the gold and silver of our age, so let's spread it out beautifully on the screen!

[Check out the documentation here!](http://docs.makie.org/stable/)

[![][docs-stable-img]][docs-stable-url] [![][docs-master-img]][docs-master-url] [![](https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Follow%20%40MakiePlots)](https://twitter.com/MakiePlots)


[gitlab-img]: https://gitlab.com/JuliaGPU/Makie.jl/badges/master/pipeline.svg
[gitlab-url]: https://gitlab.com/JuliaGPU/Makie.jl/pipelines
[docs-stable-img]: https://img.shields.io/badge/docs-stable-lightgrey.svg
Expand All @@ -26,9 +29,14 @@ Data is the gold and silver of our age, so let's spread it out beautifully on th

If you use Makie for a scientific publication, please cite [our JOSS paper](https://joss.theoj.org/papers/10.21105/joss.03349) the following way:

> Danisch & Krumbiegel, (2021). Makie.jl: Flexible high-performance data visualization for Julia. Journal of Open Source Software, 6(65), 3349, https://doi.org/10.21105/joss.03349
```
Danisch & Krumbiegel, (2021). Makie.jl: Flexible high-performance data visualization for Julia.
Journal of Open Source Software, 6(65), 3349, https://doi.org/10.21105/joss.03349
```

BibTeX entry:

<details>
<summary>BibTeX entry:</summary>

```bib
@article{DanischKrumbiegel2021,
Expand All @@ -44,6 +52,7 @@ BibTeX entry:
journal = {Journal of Open Source Software}
}
```
</details>

or [Download the BibTeX file](./assets/DanischKrumbiegel2021.bibtex).

Expand Down Expand Up @@ -71,6 +80,9 @@ using GLMakie

## Developing Makie

<details>
<summary><span style="color:red"> 🔥 Click for more 🔥</span></summary>

Makie and its backends all live in the Makie monorepo.
This makes it easier to change code across all packages.
Therefore, dev'ing Makie almost works as with other Julia packages, just, that one needs to also dev the sub packages:
Expand All @@ -85,18 +97,21 @@ To run the tests, you also should add:
]dev dev/Makie/ReferenceTests
```
For more info about ReferenceTests, check out its [README](./ReferenceUpdater/README.md)
</details>

# Quick start
# Examples

The following examples are supposed to be self-explanatory. For further information [check out the documentation!](http://docs.makie.org/stable/)

### A simple parabola

```julia
x = 1:10
fig = lines(x, x.^2; label = "Parabola")
axislegend()
save("./assets/parabola.png", fig, resolution = (600, 400))
x = 1:0.1:10
fig = lines(x, x.^2; label = "Parabola",
axis = (; xlabel = "x", ylabel = "y", title ="Title"),
figure = (; resolution = (800,600), fontsize = 22))
axislegend(; position = :lt)
save("./assets/parabola.png", fig)
fig
```

Expand All @@ -105,10 +120,14 @@ fig
### A more complex plot with unicode characters and LaTeX strings:
[Similar to the one on this link](<https://github.com/gcalderone/Gnuplot.jl#a-slightly-more-complex-plot-with-unicode-on-x-tics>)

<details>
<summary>Show Code</summary>

```julia
x = -2pi:0.1:2pi
approx = fill(0.0, length(x))
set_theme!(palette = (; patchcolor = cgrad(:Egypt, alpha=0.65)))
cmap = [:gold, :deepskyblue3, :orangered, "#e82051"]
set_theme!(palette = (; patchcolor = cgrad(cmap, alpha=0.45)))
fig, axis, lineplot = lines(x, sin.(x); label = L"sin(x)", linewidth = 3, color = :black,
axis = (; title = "Polynomial approximation of sin(x)",
xgridstyle = :dash, ygridstyle = :dash,
Expand All @@ -122,34 +141,40 @@ band!(x, sin.(x), approx .+= x .^ 5 / 120; label = L"n = 2")
band!(x, sin.(x), approx .+= -x .^ 7 / 5040; label = L"n = 3")
limits!(-3.8, 3.8, -1.5, 1.5)
axislegend(; position = :ct, bgcolor = (:white, 0.75), framecolor = :orange)
save("./assets/approxsin.png", fig, resolution = (600, 400))
save("./assets/approxsin.png", fig, resolution = (800, 600))
fig
```
</details>

<img src="./assets/approxsin.png">

### Simple layout: Heatmap, contour and 3D surface plot

<details>
<summary>Show Code</summary>

```julia
x = y = -5:0.5:5
z = x .^ 2 .+ y' .^ 2
set_theme!(colormap = :Hiroshige)
fig = Figure()
cmap = :plasma
set_theme!(colormap = cmap)
fig = Figure(fontsize = 22)
ax3d = Axis3(fig[1, 1]; aspect = (1, 1, 1),
perspectiveness = 0.5, azimuth = 2.19, elevation = 0.57)
ax2d = Axis(fig[1, 2]; aspect = 1)
ax2d = Axis(fig[1, 2]; aspect = 1, xlabel = "x", ylabel="y")
pltobj = surface!(ax3d, x, y, z; transparency = true)
heatmap!(ax2d, x, y, z; colormap = (:Hiroshige, 0.5))
heatmap!(ax2d, x, y, z; colormap = (cmap, 0.65))
contour!(ax2d, x, y, z; linewidth = 2, levels = 12, color = :black)
contour3d!(ax3d, x, y, z; linewidth = 4, levels = 12,
transparency = true)
Colorbar(fig[1, 3], pltobj)
Colorbar(fig[1, 3], pltobj; label="z", labelrotation=pi)
colsize!(fig.layout, 1, Aspect(1, 1.0))
colsize!(fig.layout, 2, Aspect(1, 1.0))
resize_to_layout!(fig)
save("./assets/simpleLayout.png", fig)
fig
```
</details>

<img src="./assets/simpleLayout.png">

Expand Down
2 changes: 1 addition & 1 deletion WGLMakie/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RelocatableFolders = "0.1, 0.2, 0.3, 1.0"
ShaderAbstractions = "0.3"
PrecompileTools = "1.0"
StaticArrays = "0.12, 1.0"
PNGFiles = "0.3"
PNGFiles = "0.3, 0.4"
julia = "1.3"

[extras]
Expand Down
Binary file modified assets/approxsin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/parabola.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/simpleLayout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 4 additions & 6 deletions docs/_layout/foot.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@
</script>
{{end}}

<!-- <script src="/libs/minimal-mistakes/main.min.js"></script> -->
<script defer src="https://use.fontawesome.com/releases/v5.8.2/js/all.js" integrity="sha384-DJ25uNYET2XCl5ZF++U8eNxPWqcKohUUBUpKGlNLMchM7q4Wjg2CUpjHLaL8yYPH" crossorigin="anonymous"></script>
<!-- Cloudflare Web Analytics -->
<script defer src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon='{"token": "1d64fe1c797349838c82c16b692ff9b2"}'></script>
<!-- End Cloudflare Web Analytics -->
<!-- 100% privacy-first analytics -->
<script async defer src="https://api.makie.org/latest.js"></script>
<noscript><img src="https://api.makie.org/noscript.gif" alt="" referrerpolicy="no-referrer-when-downgrade" /></noscript>

{{ if hasmath }}
{{ insert foot_katex.html }}
Expand All @@ -70,4 +68,4 @@
{{ insert foot_highlight.html }}
{{ end }}
</body>
</html>
</html>
9 changes: 7 additions & 2 deletions src/makielayout/blocks/polaraxis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function draw_axis!(po::PolarAxis, axis_radius)
pop!(_thetaticklabels)
end

thetatick_align.val = map(_thetatickvalues) do angle
thetatick_align[] = map(_thetatickvalues) do angle
s, c = sincos(angle + theta_0)
scale = 1 / max(abs(s), abs(c)) # point on ellipse -> point on bbox
Point2f(0.5 - 0.5scale * c, 0.5 - 0.5scale * s)
Expand Down Expand Up @@ -263,9 +263,14 @@ function draw_axis!(po::PolarAxis, axis_radius)
color = po.thetaticklabelcolor,
strokewidth = po.thetaticklabelstrokewidth,
strokecolor = thetastrokecolor,
align = thetatick_align,
align = thetatick_align[]
)

# Hack to deal with synchronous update problems
on(thetatick_align) do align
thetaticklabelplot.align.val = align
end

# inner clip
# scatter shouldn't interfere with lines and text in GLMakie, so this should
# look a bit cleaner
Expand Down
6 changes: 3 additions & 3 deletions src/makielayout/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1506,11 +1506,11 @@ end
"The z tick width"
ztickwidth = 1
"The size of the xtick marks."
xticksize::Float64 = 12f0
xticksize::Float64 = 6
"The size of the ytick marks."
yticksize::Float64 = 12f0
yticksize::Float64 = 6
"The size of the ztick marks."
zticksize::Float64 = 12f0
zticksize::Float64 = 6
"The color of x spine 1 where the ticks are displayed"
xspinecolor_1 = :black
"The color of y spine 1 where the ticks are displayed"
Expand Down

0 comments on commit 702a6bc

Please sign in to comment.