help i’m new to this and i don’t know how i could graph a ternary contour in julia, does anyone know how i could do it?
Ternary contour plot syntax in Julia is almost the same as ternary plot syntax in Python. You can likely figure it out from these docs:
After you have the plot working, please see this chapter for adding Julia plots to your Julia Dash app:
https://dash-julia.plotly.com/interactive-graphing
Sorry for the long delay in response here. In the future, you’ll likely get a faster reply if posting at https://discourse.julialang.org
I’ve already seen that documentation but I can’t find the ternary plot for julia
Hi @emilio_alvizo,
With PlotlyJS.jl you can plot only scatterternary. Here is the list of available traces: https://github.com/sglyon/PlotlyBase.jl/blob/2494101ba3f8ff9be9063db5fd69df1ae696c605/src/api.jl#L19.
Scatternary plot is intended for plotting data representing values of three variables A, B, C with cosnstant sum:
A+B+C=constant (usually 1 or 100).
Here is an example:
using PlotlyJS
#include style file: https://gist.github.com/empet/6b4f441ed96d724d67ff77f1fb8b0a79
include("plotlyju.jl")
mydata=[64 27 9;
81 10 9;
66 15 19;
2 40 58;
18 23 59;
95 1 4;
44 22 34;
51 38 11;
64 32 4;
56 5 39;
25 71 4;
75 11 14;
73 21 6;
97 3 0;
85 6 9]
#Check the sum on rows
s=sum(mydata, dims=(2))
#print(s)
trace = scatterternary(a=mydata[:,1],
b=mydata[:, 2],
c=mydata[:, 3],
mode="markers",
marker_size=14,
marker_color="blue",
marker_symbol="triangle-down"
)
layout =Layout(width=500, height=500, margin_t=150, title_text="Scatterternary Plot",
ternary=attr(sum=100,
aaxis_title='A',
baxis_title='B',
caxis_title='C'))
fig = plot(trace, layout, style=plotlyju)
display(fig)
or another version:
fig = Plot(style=plotlyju)
fig.data=[scatterternary(a=mydata[:,1],
b=mydata[:, 2],
c=mydata[:, 3],
mode="markers",
marker_size=12,
marker_color="red" #here is used the default marker_symbol="circle"
)];
fig.layout = Layout(width=500, height=500, title_text="Scatterternary Plot",
ternary=attr(sum=100,
aaxis_title='A',
baxis_title='B',
caxis_title='C'))
plot(fig)
To save your figure as png, jpg, svg, or pdf plot, use savefig
:
savefig(fig, "scatterternary.png", width=500, height=500, scale=1)
It is a pity that contours cannot be plotted, how unfortunate