Plotting figures

Usage

WandaToolbox supports plotting various objects to a formatted PDF, which can be included as an appendix in your report. WandaToolbox.wanda_plot supports time and location series where data is exported directly from Wanda models. It also supports adding tables, images or text blocks on pages, and supports generating system characteristics for a range of flow rates and discharge points.

Code example:

 1from wandatoolbox.wanda_plot import PlotSyschar, PlotText, PlotTable, PlotImage, plot
 2import matplotlib.pyplot as plt
 3from matplotlib.backends.backend_pdf import PdfPages
 4import pandas as pd
 5import pywanda as pw
 6
 7model = pw.WandaModel(r'c:\Wandamodel.wdi', 'c:\Wanda 4.6\Bin\\')
 8img = plt.imread('WandaToolbox\data\DELTARES_ENABLING_CMYK.png')
 9df = pd.read_excel(r'example_data\syschar_test.xlsx', header=0, index_col=0)
10scenario_names = ["Current min", "Current max", "Future min", "Future max"]
11
12with PdfPages(f'Document.pdf') as pdf:
13    subplots_table = [
14        PlotTable(df, ['description', "Current min", "Current max", "Future min", "Future max"]),
15        PlotImage(img), PlotText("Yada yada yada"),
16        PlotSyschar("BOUNDQ B1", 105.0, "Supplier #1", df, 'Wanda_name',
17        scenario_names, 3, "Industry description", 'Discharge (m3/day)', 'Head (m)')
18    ]
19    plot(model, subplots_table,
20        'Main title',
21        f'Subtitle 1',
22        'Subtitle 2',
23        'Subtitle 3',
24        'Subtitle 4',
25        f'Figure number: 1',
26        company_image=plt.imread('WandaToolbox\data\DELTARES_ENABLING_CMYK.png'),
27        fontsize=10)
28    pdf.savefig()
29    plt.close()