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

SPF-OST / pytrnsys_process / 12054310271

27 Nov 2024 04:18PM UTC coverage: 89.748% (-0.8%) from 90.52%
12054310271

push

github

sebastian-swob
added more useful docstrings,
added imports to source __init__.py,
wrapper methods for plots

15 of 21 new or added lines in 4 files covered. (71.43%)

499 of 556 relevant lines covered (89.75%)

1.79 hits per line

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

53.85
/pytrnsys_process/plotting/plot_wrappers.py
1
import typing as _tp
2✔
2

3
import matplotlib.pyplot as _plt
2✔
4
import pandas as _pd
2✔
5

6
from pytrnsys_process.plotting import plotters as pltrs
2✔
7

8

9
def line_plot(
2✔
10
        df: _pd.DataFrame,
11
        columns: list[str],
12
        use_legend: bool = True,
13
        size: tuple[float, float] = pltrs.LinePlot.SIZE_A4,
14
        **kwargs: _tp.Any,
15
) -> _plt.Figure:
16
    """Create a line plot from the given DataFrame columns.
17

18
    Args:
19
        df: DataFrame containing the data to plot
20
        columns: List of column names to plot
21
        use_legend: Whether to show the legend
22
        size: Figure size tuple (width, height)
23
        **kwargs: Additional plotting arguments passed to pandas plot()
24

25
    Returns:
26
        matplotlib Figure object
27
    """
NEW
28
    plotter = pltrs.LinePlot()
×
NEW
29
    return plotter.plot(
×
30
        df, columns, use_legend=use_legend, size=size, **kwargs
31
    )
32

33

34
def bar_chart(
2✔
35
        df: _pd.DataFrame,
36
        columns: list[str],
37
        use_legend: bool = True,
38
        size: tuple[float, float] = pltrs.BarChart.SIZE_A4,
39
        **kwargs: _tp.Any,
40
) -> _plt.Figure:
41
    """Create a bar chart with multiple columns displayed as grouped bars.
42

43
    Args:
44
        df: DataFrame containing the data to plot
45
        columns: List of column names to plot as bars
46
        use_legend: Whether to show the legend
47
        size: Figure size tuple (width, height)
48
        **kwargs: Additional plotting arguments
49

50
    Returns:
51
        matplotlib Figure object
52
    """
NEW
53
    plotter = pltrs.BarChart()
×
NEW
54
    return plotter.plot(
×
55
        df, columns, use_legend=use_legend, size=size, **kwargs
56
    )
57

58

59
def stacked_bar_chart(
2✔
60
        df: _pd.DataFrame,
61
        columns: list[str],
62
        use_legend: bool = True,
63
        size: tuple[float, float] = pltrs.StackedBarChart.SIZE_A4,
64
        **kwargs: _tp.Any,
65
) -> _plt.Figure:
66
    """Create a stacked bar chart from the given DataFrame columns.
67

68
    Args:
69
        df: DataFrame containing the data to plot
70
        columns: List of column names to plot
71
        use_legend: Whether to show the legend
72
        size: Figure size tuple (width, height)
73
        **kwargs: Additional plotting arguments
74

75
    Returns:
76
        matplotlib Figure object
77
    """
NEW
78
    plotter = pltrs.StackedBarChart()
×
NEW
79
    return plotter.plot(
×
80
        df, columns, use_legend=use_legend, size=size, **kwargs
81
    )
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

© 2025 Coveralls, Inc