# Beautiful Makie Gallery

**URL:** <https://discourse.julialang.org/t/beautiful-makie-gallery/62523>\
**Category:** Package Announcements\
**Created:** [June 7, 2021, 2:29pm UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523 "2021-06-07T14:29:56Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![liuyxpp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/liuyxpp/32/9870_2.png) [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Post date:** [June 12, 2021, 7:22am UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/61 "2021-06-12T07:22:23Z")

</div>

I just want to express the feeling that it seems that all Makie plots shown I’ve seen have all those saturated colors (including most plots in this thread). If I were to use Makie, I will definitely define my own color cycle.

---

<div class="post-metadata">

**Author:** ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Post date:** [June 12, 2021, 7:40am UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/62 "2021-06-12T07:40:00Z")

</div>

go for it. And let’s see how it turns out, if possible.

---

<div class="post-metadata">

**Author:** ![EvoArt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/evoart/32/25357_2.png) [@EvoArt](https://discourse.julialang.org/u/EvoArt)\
**Post date:** [June 12, 2021, 9:40am UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/63 "2021-06-12T09:40:50Z")

</div>

Fantastic. I learned a fair bit, from reading your code. Not sure if the challenger @StevenSiew was expecting such a response?

Either way, I think challenges/competitions are a great way to draw out clever use of code.

---

<div class="post-metadata">

**Author:** ![EvoArt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/evoart/32/25357_2.png) [@EvoArt](https://discourse.julialang.org/u/EvoArt)\
**Post date:** [June 12, 2021, 5:07pm UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/64 "2021-06-12T17:07:19Z")

</div>

In that spirit, here is something that can be done in MATLAB. I’d be very impressed if the bottom right figure could be produced in Makie

 ![screenshot](https://global.discourse-cdn.com/julialang/original/3X/2/c/2c72abd05269f07291df32b42a489106956f65ed.png)

Disclaimer: I’m really just hoping someone can do it, so I can borrow their code!

---

<div class="post-metadata">

**Author:** ![feanor12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/feanor12/32/8212_2.png) [@feanor12](https://discourse.julialang.org/u/feanor12)\
**Post date:** [June 12, 2021, 7:16pm UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/65 "2021-06-12T19:16:08Z")

</div>

There is a package build for GR/Plots called [TernaryPlots.jl](https://github.com/jacobusmmsmit/TernaryPlots.jl) . Maybe this includes a lot things that are needed for this, in case it is not implemented yet.

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [June 12, 2021, 8:06pm UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/66 "2021-06-12T20:06:54Z")

</div>

The only problem should be drawing the axis 😉 Which isn’t a big problem I suppose, just a bit of work

---

<div class="post-metadata">

**Author:** ![EvoArt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/evoart/32/25357_2.png) [@EvoArt](https://discourse.julialang.org/u/EvoArt)\
**Post date:** [June 12, 2021, 8:15pm UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/67 "2021-06-12T20:15:30Z")

</div>

Thanks, converting to barrycentric coordinates is fairly trivial. I’ve had some success making 2d ternary quiver plots using plots.jl and just drawing the axes as plots. I’ve managed to make a ternary surface in pgfplots, but the wasn’t very polished. Looking at the plots produced by @lazarusA I think Makie would be ideal for making a really nice ternary surface plot. Better than the one I attached. I will have a crack at it tonight, if the kids let me.

---

<div class="post-metadata">

**Author:** ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Post date:** [June 12, 2021, 8:23pm UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/68 "2021-06-12T20:23:04Z")

</div>

everything is just a little bit of work 😃

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [June 12, 2021, 8:45pm UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/69 "2021-06-12T20:45:11Z")

</div>

I thought it could be tricky in terms of converts and projections if one wanted to add this as a real axis type. Like a scatter! with three arguments referring to a position in the triangle in that axis, not a 3d plot, etc.

Just drawing a thing like that while manually preparing the projected data etc, would not be very tricky I think.

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [June 12, 2021, 9:02pm UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/70 "2021-06-12T21:02:17Z")

</div>

A next-level challenge is adding a data dimension: tetrahedral plot with 4 axes, 3 independent.

---

<div class="post-metadata">

**Author:** ![klaff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/klaff/32/7637_2.png) [@klaff](https://discourse.julialang.org/u/klaff)\
**Post date:** [June 13, 2021, 3:45am UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/71 "2021-06-13T03:45:41Z")

</div>

Here’s a chromaticity diagram, including blackbody curve and the sRGB gamut:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/6/5/656638e3af911968ce0428968bf1ff98858b86c5.jpeg)

This is my effort to learn a bit about Makie, so my code may not be ideal. I welcome any improvements.

```julia
### A Pluto.jl notebook ###
# v0.14.8

using Markdown
using InteractiveUtils

# ╔═╡ 0dc0ad8d-9451-405c-8cd9-894553ab5cc0
begin
	using Pkg
	Pkg.activate(mktempdir())
	Pkg.add("Colors"); using Colors
	Pkg.add("GLMakie"); using GLMakie
	#Pkg.add("Images"); using Images
	Pkg.add("PolygonOps"); using PolygonOps
end

# ╔═╡ f22934c0-c99c-11eb-02bd-7f3d9d71104e
md"""
##### Chromaticity diagram in Makie
"""

# ╔═╡ 2fdc73a2-eaad-4b9a-a1cf-bc03cf873d8b
function xy_from_λ(λ)
	c = xyY(colormatch(λ))
	return c.x,c.y
end

# ╔═╡ 5344f9c7-e7ab-428e-9ff5-a03ea3ee3ea6
begin
	ml_xy = xy_from_λ.(400:700)
	ml_poly = [ml_xy; ml_xy[begin]]
end;

# ╔═╡ bd8d96ca-ea38-4134-929d-29de7cf7543f
begin
	scale = 2
	alpha=1.0 # set to 0.75 for slightly visible gridlines
	xi = 0:770scale
	yi = 0:870scale
	z = zeros(RGBA, length(xi), length(yi))
	for x in xi
		for y in yi
			cx = x/1000scale
			cy = y/1000scale
			if inpolygon((cx,cy), ml_poly)==1
				c = RGB(xyY(cx,cy,1e-6))
				k = 1.0/maximum((c.r, c.g, c.b))
				c = RGBA(k*c.r, k*c.g, k*c.b, alpha)
				z[x+1,y+1] = c
			else
				z[x+1,y+1] = RGBA(0, 0, 0, alpha)
			end
		end
	end
end

# ╔═╡ 1b6264d2-1f32-44b5-b616-afcdde57bf93
ml_ticks = [400, 470, 480, 485, 490, 495, 500, 505, 510, 520, 
	        530, 540, 550, 560, 570, 580, 590, 600, 620, 700];

# ╔═╡ b1251318-2bd8-4d97-9fda-8839a193a03c
function M(λ,T)
	h = 6.62607015e-34 # J/Hz
	c = 2.99792458e8 # m/s
	k = 1.380649e-23 # J/K
	c1 = 2π*h*c^2
	c2 = h*c/k
	λ = λ/1e9
	return c1/λ^5/(exp(c2/(λ*T))-1)
end

# ╔═╡ 77daa5fd-25b2-43aa-990e-07d9cde8cf6d
function xy_from_T(T)
	c = sum(colormatch.(360:760).*M.(360:760,T))
	m = max(c.x, c.y, c.z)
	c = xyY(XYZ(c.x/m, c.y/m, c.z/m))
	return c.x, c.y
end

# ╔═╡ cc5500cc-9c8c-4af1-95a3-8f7f5ba1c61e
Planckian_ticks = [1500, 2000, 3000, 4000, 5000, 6500, 10000]

# ╔═╡ df5c10ce-21a6-487f-9f07-28d3b6486b97
begin
	fig = Figure(backgroundcolor = RGB(0,0,0),
		         textcolor=:white,
                 resolution = (1000, 1000))
	ax1 = fig[1, 1] = Axis(fig, title = "Chromaticity Diagram")
	ax1.xticks=0.0:0.1:0.8
	ax1.yticks=0.0:0.1:0.9
	image!(ax1, 
		   0.0:.01:0.77,
		   0.0:0.01:0.87, 
		   z)
	lines!(ax1,
		   [p[1] for p in ml_poly],
		   [p[2] for p in ml_poly],
	       linewidth=1.5,
		   color=:black)
	scatter!(ax1,
		     xy_from_λ.(ml_ticks),
		     color=:white,
	         marker=:x)
	annotations!(ax1,
		         string.(ml_ticks),
		         Point.(xy_from_λ.(ml_ticks)); 
		         color=:grey60)
	lines!(ax1,
		   xy_from_T.(1000:5:10000), color=:white)
	scatter!(ax1,
		     xy_from_T.(Planckian_ticks),
	         marker=:x)
	annotations!(ax1,
		         string.(Planckian_ticks),
		         Point.(xy_from_T.(Planckian_ticks)),
	             offset = (-20, -30),
	             color=:white)
	lines!(ax1,
		   [(0.64, 0.33), (0.3, 0.6), (0.15, 0.06), (0.64, 0.33)],
	       color=:white)
	fig
end

# ╔═╡ Cell order:
# ╟─f22934c0-c99c-11eb-02bd-7f3d9d71104e
# ╠═2fdc73a2-eaad-4b9a-a1cf-bc03cf873d8b
# ╠═5344f9c7-e7ab-428e-9ff5-a03ea3ee3ea6
# ╠═bd8d96ca-ea38-4134-929d-29de7cf7543f
# ╠═1b6264d2-1f32-44b5-b616-afcdde57bf93
# ╠═b1251318-2bd8-4d97-9fda-8839a193a03c
# ╠═77daa5fd-25b2-43aa-990e-07d9cde8cf6d
# ╠═cc5500cc-9c8c-4af1-95a3-8f7f5ba1c61e
# ╠═df5c10ce-21a6-487f-9f07-28d3b6486b97
# ╠═0dc0ad8d-9451-405c-8cd9-894553ab5cc0

```

---

<div class="post-metadata">

**Author:** ![EvoArt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/evoart/32/25357_2.png) [@EvoArt](https://discourse.julialang.org/u/EvoArt)\
**Post date:** [June 13, 2021, 6:34pm UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/72 "2021-06-13T18:34:07Z")

</div>

Got a rough version going.  
 ![tern](https://global.discourse-cdn.com/julialang/original/3X/a/0/a095608471fd3e8754cc00731eb54a33526debd1.png)

---

<div class="post-metadata">

**Author:** ![EvoArt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/evoart/32/25357_2.png) [@EvoArt](https://discourse.julialang.org/u/EvoArt)\
**Post date:** [June 13, 2021, 6:43pm UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/73 "2021-06-13T18:43:17Z")

</div>

The original was actually a density plot of data. I’ll need to play around with KDEs and transformations and recreate the original post, with code.

---

<div class="post-metadata">

**Author:** ![StatisticalMouse](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/statisticalmouse/32/43370_2.png) [@StatisticalMouse](https://discourse.julialang.org/u/StatisticalMouse)\
**Post date:** [June 13, 2021, 7:00pm UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/74 "2021-06-13T19:00:06Z")

</div>

A plot of the Palmer penguins with a map would be interesting. Google maps is not particularly good for that neighbourhood, like Dream island pointed to a place that is just empty.  
Edit: there’s a pengun webcam, but it’s not online this time of the year. That makes sense, there’d be winter now. [The USAP Portal: Science and Support in Antarctica - Palmer Station Webcams](https://www.usap.gov/videoclipsandmaps/palwebcam.cfm)

---

<div class="post-metadata">

**Author:** ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Post date:** [June 13, 2021, 8:04pm UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/75 "2021-06-13T20:04:06Z")

</div>

drop some coordinates, and let’s see what can be done 😃

---

<div class="post-metadata">

**Author:** ![piever](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/piever/32/1815_2.png) [@piever](https://discourse.julialang.org/u/piever)\
**Post date:** [June 13, 2021, 8:20pm UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/76 "2021-06-13T20:20:56Z")

</div>

Not sure if it helps, but [here](http://juliaplots.org/AlgebraOfGraphics.jl/dev/generated/gallery/#Geographic-data) there is an example of plotting the Antarctic coastline with AlgebraOfGraphics (including a small snippet to download coordinates as a shapefile).

---

<div class="post-metadata">

**Author:** ![StatisticalMouse](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/statisticalmouse/32/43370_2.png) [@StatisticalMouse](https://discourse.julialang.org/u/StatisticalMouse)\
**Post date:** [June 13, 2021, 8:27pm UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/77 "2021-06-13T20:27:25Z")

</div>

Finding a good map is a challenge, I’ll update when I’ve found something.

---

<div class="post-metadata">

**Author:** ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Post date:** [June 13, 2021, 8:31pm UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/78 "2021-06-13T20:31:49Z")

</div>

I mean, just show me where the penguins are (coordinates) and I will do a map. There are probably a few trackers on them. Or some stations where they are normally observed.

---

<div class="post-metadata">

**Author:** ![StatisticalMouse](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/statisticalmouse/32/43370_2.png) [@StatisticalMouse](https://discourse.julialang.org/u/StatisticalMouse)\
**Post date:** [June 13, 2021, 8:42pm UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/79 "2021-06-13T20:42:35Z")

</div>

> **[Biscoe Islands](https://en.wikipedia.org/wiki/Biscoe_Islands)**
>
> Biscoe Islands is a series of islands, of which the principal ones are Renaud, Lavoisier (named Serrano by Chile and Mitre by Argentina), Watkins, Krogh, Pickwick and Rabot, lying parallel to the west coast of Graham Land and extending 150 km (81 nmi) between Southwind Passage on the northeast and Matha Strait on the southwest. Another group of islands are the Adolph Islands.
> The islands are named for John Biscoe, the commander of a British expedition which explored the islands in February 183...

---

<div class="post-metadata">

**Author:** ![StatisticalMouse](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/statisticalmouse/32/43370_2.png) [@StatisticalMouse](https://discourse.julialang.org/u/StatisticalMouse)\
**Post date:** [June 13, 2021, 8:44pm UTC](https://discourse.julialang.org/t/beautiful-makie-gallery/62523/80 "2021-06-13T20:44:25Z")

</div>

![image](https://global.discourse-cdn.com/julialang/original/3X/1/9/19bb189fb7f8057595241263a2852b0d1a9d5bc2.png)  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/5/d/5d367818c902589d7d0821bb5fea4620aae1b32a.png)  
Maps at the end of [https://www.google.fi/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwjo5tW5vZXxAhVW\_ioKHTzWDmAQFjAAegQIAhAD&url=http%3A%2F%2Fwww.ats.aq%2Fdocuments%2Frecatt%2FAtt455\_e.pdf&usg=AOvVaw2GEclLhZV91PYUX8Tfxekb](https://www.google.fi/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwjo5tW5vZXxAhVW_ioKHTzWDmAQFjAAegQIAhAD&url=http%3A%2F%2Fwww.ats.aq%2Fdocuments%2Frecatt%2FAtt455_e.pdf&usg=AOvVaw2GEclLhZV91PYUX8Tfxekb)

[Previous page](https://discourse.julialang.org/t/beautiful-makie-gallery/62523.md?page=3)

[Next page](https://discourse.julialang.org/t/beautiful-makie-gallery/62523.md?page=5)
