-
Notifications
You must be signed in to change notification settings - Fork 0
/
myplot.jl
32 lines (26 loc) · 904 Bytes
/
myplot.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using JuLIP, JuLIP.Potentials, PlotlyJS, PyPlot
function myplot(at, ttl = nothing)
x, y, _ = xyz(at)
r = at.M
N = length(at.Z)
color = Array{String}(N)
for i = 1:N
z = at.Z[i];
if z == 1
color[i] = "blue";
else
color[i] = "red";
end
# PyPlot.plot(mod(x[i],1), mod(y[i],1), color, markersize=20) #set to be mod(x, Lx), mod(y, Ly)
end
if ttl != nothing
title(ttl)
end
cell_x = [0.0, 1.0, 1.0, 0.0, 0.0]
cell_y = [0.0, 0.0, 1.0, 1.0, 0.0]
shape = [circle(x0=mod(x[i],1)-r[i], y0=mod(y[i],1)-r[i],
x1=mod(x[i],1)+r[i], y1=mod(y[i],1)+r[i];
opacity = 0.8, fillcolor=color[i], line_color="transparent")
for i in 1:N]
PlotlyJS.plot(cell_x, cell_y, Layout(;height=600,width=600,showlegend=false,shapes=shape))
end