Julia. Les premiers pas, quatrième partie

using Dates

let # portée locale
    d = Dates.now()
    println("Daniel Hagnoul $d\n")
end
Daniel Hagnoul 2020-10-27T08:35:15.307

Plot

ENV["GKS_ENCODING"] = "utf-8" # en latin=1 par défaut
using Plots
let
    x = 1:3;
    y = [1.0 4.0; 4.0 2.0; 8.0 1.0]

    p = plot(x, y, title="Deux lignes", label=["Ligne 1" "Ligne 2"], lw=2)

    xlabel!(p, "X")
    ylabel!(p, "y")
end
let
    x = 1:3
    y = [1.0, 4.0, 2.0]

    p = bar(x, y, title="Barre", label="Barre", lw=2)

    xlabel!(p, "X")
    ylabel!(p, "y")
end
let
    # rand(600) soit 600 valeurs aléatoires, doit être égal à 3 * 200 dans repeat(1:3, outer=200)
    
    p = histogram(randn(600), bins=:scott, weights=repeat(1:3, outer=200), title="Histogramme", label="Fréquence", lw=2)

    xlabel!(p, "X")
    ylabel!(p, "y")
end
let
    x = 1:10;
    y = rand(10, 2)

    p = scatter(x, y, title="Séries de points", label = ["Série 1" "Série 2"], lw=2)

    xlabel!(p, "X")
    ylabel!(p, "y")
end

Graph

using LightGraphs, GraphPlot, Compose, Cairo, Fontconfig

#= 
    Graphes et Julia par Thibaut Cuvelier
    https://tcuvelier.developpez.com/tutoriels/julia/introduction-lightgraphs-1.2/
    2. Création d'un graphe dirigé : DiGraph
=#

g = DiGraph(3)

add_edge!(g, 1, 2)
add_edge!(g, 3, 1)
add_edge!(g, 2, 3)

nodelabel = 1:nv(g)
p = gplot(g, nodelabel=nodelabel)

Pour d'autres graphes, voir : Graphes et Julia par Thibaut Cuvelier

Licence Creative Commons Attribution 2.0 Belgique