You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for putting together this package. I would like to plot a 3-simplex in a ternary diagram where the fourth dimension represented by a color gradient. I encountered problems adding axis labels and representing two groups of data with different marker shapes. I was wondering if you might provide some guidance. Here is a MWE:
using Makie
using GLMakie
using TernaryDiagrams
using Distributions
using ColorSchemes
fig = Figure();
ax = Axis(fig[1, 1]);
ternaryaxis!(ax; labelx = "1", labely = "2", labelz = "3");
data1 = rand(Dirichlet([5,1,1,10]), 10)'
data2 = rand(Dirichlet([1,5,1,1]), 10)'
ternaryscatter!(
ax,
data1[:,1],
data1[:,2],
data1[:,3],
color = [get(ColorSchemes.Spectral, w, extrema(data1[:,4])) for w in data1[:,4]],
marker = :circle,
markersize = 20
)
ternaryscatter!(
ax,
data2[:,1],
data2[:,2],
data2[:,3],
color = [get(ColorSchemes.Spectral, w, extrema(data2[:,4])) for w in data2[:,4]],
marker = :triangle,
markersize = 20
)
fig
Thank you in advance.
The text was updated successfully, but these errors were encountered:
What was the issue? The below code seems to produce a sensible image (slight adaptations from your code):
using GLMakie
using TernaryDiagrams
using Distributions
using ColorSchemes
fig = Figure();
ax = Axis(fig[1, 1]);
ternaryaxis!(ax; labelx = "1", labely = "2", labelz = "3");
data1 = rand(Dirichlet([5,1,1,10]), 10)'
data2 = rand(Dirichlet([1,5,1,1]), 10)'
ternaryscatter!(
ax,
data1[:,1],
data1[:,2],
data1[:,3],
color = [get(ColorSchemes.Reds, w, extrema(data1[:,4])) for w in data1[:,4]],
marker = :circle,
markersize = 20
)
ternaryscatter!(
ax,
data2[:,1],
data2[:,2],
data2[:,3],
color = [get(ColorSchemes.Blues, w, extrema(data2[:,4])) for w in data2[:,4]],
marker = :utriangle,
markersize = 20
)
xlims!(ax, -0.2, 1.2) # to center the triangle and allow space for the labels
ylims!(ax, -0.3, 1.1)
hidedecorations!(ax) # to hide the axis decorations
fig
Hello,
Thank you for putting together this package. I would like to plot a 3-simplex in a ternary diagram where the fourth dimension represented by a color gradient. I encountered problems adding axis labels and representing two groups of data with different marker shapes. I was wondering if you might provide some guidance. Here is a MWE:
Thank you in advance.
The text was updated successfully, but these errors were encountered: