• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DIGNEA / DIGNEApy / 26040537195

18 May 2026 02:40PM UTC coverage: 91.886% (-0.1%) from 91.988%
26040537195

push

github

amarrerod
All tests passing in local. Updating examples to new interfaces.

2 of 2 new or added lines in 2 files covered. (100.0%)

24 existing lines in 9 files now uncovered.

1778 of 1935 relevant lines covered (91.89%)

1.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.0
/digneapy/visualize/_evo_generator_evolution_plot.py
1
#!/usr/bin/env python
2
# -*-coding:utf-8 -*-
3
"""
4
@File    :   _evo_generator_evolution_plot.py
5
@Time    :   2024/09/18 11:03:49
6
@Author  :   Alejandro Marrero
7
@Version :   1.0
8
@Contact :   amarrerd@ull.edu.es
9
@License :   (C)Copyright 2024, Alejandro Marrero
10
@Desc    :   None
11
"""
12

13
from typing import Optional
2✔
14

15
import matplotlib
2✔
16

17
matplotlib.use("Agg")  # Non-interactive backend
2✔
18
from pathlib import Path
2✔
19

20
import matplotlib.pyplot as plt
2✔
21
import pandas as pd
2✔
22
import seaborn as sns
2✔
23
from matplotlib.lines import Line2D
2✔
24

25

26
def ea_generator_evolution_plot(logbook=None, filename: Optional[str | Path] = ""):
2✔
27
    df = pd.DataFrame(logbook.chapters["s"].select("avg"), columns=[r"$s$"])
2✔
28
    df[r"$p$"] = logbook.chapters["p"].select("avg")
2✔
29
    df["Generations"] = logbook.select("gen")
2✔
30

31
    # Plot configuration
32
    plt.rcParams["font.family"] = "serif"
2✔
33
    plt.rcParams["font.sans-serif"] = [
2✔
34
        "Tahoma",
35
        "DejaVu Sans",
36
        "Lucida Grande",
37
        "Verdana",
38
    ]
39
    plt.rcParams["font.size"] = 16
2✔
40
    plt.figure(figsize=(12, 8))
2✔
41
    ax = sns.lineplot(
2✔
42
        data=df,
43
        x="Generations",
44
        y=r"$s$",
45
        marker="o",
46
        color="blue",
47
        markersize=5,
48
        legend=False,
49
    )
50

51
    ax2 = plt.twinx()
2✔
52
    sns.lineplot(
2✔
53
        data=df,
54
        x="Generations",
55
        y=r"$p$",
56
        marker="X",
57
        markersize=5,
58
        color="red",
59
        legend=False,
60
        ax=ax2,
61
    )
62
    ax.legend(
2✔
63
        handles=[
64
            Line2D([], [], marker="o", color="blue", label=r"$s$"),
65
            Line2D([], [], marker="X", color="red", label=r"$p$"),
66
        ],
67
        loc="center right",
68
    )
69

70
    plt.title(r"Evolution of $s$ and $p$")
2✔
71
    if filename:
2✔
72
        plt.savefig(filename)
2✔
73
    else:
UNCOV
74
        plt.show()
×
75
    plt.close()
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc