I do a project about infection spreading. I want to have my network immovable but I don’t find a solution.
I also tried to have no superposition but I find nothing
Thanks a lot for your help !
My code won’t work with you because you need all my work to make it work but here is the main code for the representation.
affinite=deepcopy(affinitebase)
etat=deepcopy(etatbase)
jourMalade=deepcopy(jourMaladebase)
limnMalade=2;
resultat=zeros(nJours+1,4)
resultat[1,:]=results(etat)
FirstTime=now()
etattot=zeros(nJours+1,length(etat))
etattot[1,:]=etat;
set_default_graphic_size(20cm, 15cm)
anim=Animation()
Network = Graph(affinite)
nvertices = nv(Network) # number of vertices
nedges = ne(Network) # number of edges
nodecolor = [colorant"lightseagreen", colorant"red", colorant"orange", colorant"blue"] #["Susceptibles","Infectées","Soignées","Vaccinées"]
for j in 1:nJours
etatTest=etat;
for i in 1:length(etat)
transmission(i,etat,affinite,limnMalade,incubation,amisbase)
end
nodefillc = nodecolor[etat.+1]
layout=(args...)->spring_layout(args...; C=20)
p=gplot(Network,layout=spring_layout,nodelabel=1:nvertices,nodefillc=nodefillc)
output = compose(p,
(context(), Compose.text(0, -1, "Représentation du réseau $("aléatoire") jour $(j)", hcenter, vcenter), fontsize(24pt)),
(context(), Compose.text(-1, -0.8, "Vacciné si $(limnMalade) amis malades"), fontsize(10pt)),
(context(), circle([-1], [1-3*0.15,1-2*0.15,1-0.15,1], [0.05]), fill(nodecolor)), #Légende
(context(), Compose.text([-1+0.07], [1.04-3*0.15,1.04-2*0.15,1.04-0.15,1.04], ["Susceptible","Infecté","Soigné","Vacciné"])), #Légende
(context(), rectangle(-10,-10,20,20), fill("white"), Compose.stroke("black")))
j=length(anim.frames) + 1
tmpfilename=joinpath(anim.dir,@sprintf("%06d.png",j))
Compose.draw(PNG(tmpfilename),output)
push!(anim.frames, tmpfilename)
resultat[j+1,:]=results(etat);
end
LastTime=now();
gif(anim, "Infection$(nJours).gif", fps = 1)