Skip to content
This repository was archived by the owner on Jun 26, 2024. It is now read-only.

Commit d024318

Browse files
committed
plotting and saving plot via pyplot
1 parent cc4df49 commit d024318

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

docker-compose.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ services:
77
volumes:
88
- ".:/usr/src/"
99
working_dir: /usr/src/src/
10-
command: julia main.jl
10+
command: bash -c "chmod +x /usr/src/install-requirements.sh
11+
&& /usr/src/install-requirements.sh && julia main.jl"

install-requirements.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apt-get update && apt-get install -yq --no-install-recommends \
2+
wget \
3+
ca-certificates \
4+
python3 \
5+
python3-dev \
6+
python3-pip \
7+
python3-matplotlib

src/FireflyModule.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ module FireflyModule
4545
return dist, dist_info
4646
end
4747

48-
function caluculate_light_intensity(source_node::Firefly, destination_node::Firefly)
48+
function light_intensity(source_node::Firefly, destination_node::Firefly)
4949
"""Calculates the light intensity for the source firefly.
5050
"""
5151
end

src/main.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
using Pkg
2+
Pkg.update()
3+
Pkg.build("PyCall")
4+
15
# Pushing current dir to import modules.
26
push!(LOAD_PATH, "./")
37
import NodeModule.Node, NodeModule.euclidean_distance, NodeModule.create_distance_matrix,
@@ -89,4 +93,10 @@ for t in 1:ITERATION_NUMBER
8993
end
9094
end
9195
end
92-
end
96+
end
97+
98+
Pkg.add("PyPlot")
99+
using PyPlot
100+
x = range(0,stop=2*pi,length=1000); y = sin.(3*x + 4*cos.(2*x))
101+
plot(x, y, color="red", linewidth=2.0, linestyle="--")
102+
savefig("plot.png")

0 commit comments

Comments
 (0)