===Multiple Properties Across Sub-Plots=== This [[code:reports|code sample]] of a line-graph report. It contains several different properties on the same page, each broken into its own **sub-plot**. {{line_subplots.png|400}} ==Customising== ^Element^Replace With^ |[ASSET]|The asset you want to report on| |[PROPERTY1] etc|The names of the properties you want to report on| ==The Code== import os import sys sys.path.insert(0,os.path.dirname(os.path.dirname(__file__))) import mplreport import datetime @mplreport.ardireport("Sample Report") def CreateReport(report,args): #List of properties to show properties = ['[PROPERTY 1]','[PROPERTY 2]'] #Create a page containing a single plot. fig,axes = report.CreatePage(len(properties)) #Print a title block for the page. report.Title() #Format the list for the query... proplist = [] for prp in properties: proplist.append("'" + prp + "'") #Our AQL query goes here query = "('[ASSET]') ASSET (" + ",".join(prp) + ") PROPERTY VALUES" #Get the pandas data-frame with the results. df = report.GetHistory(query) #Work with the first set of axes for x in range(0,len(properties)): ax = axes[x] for k in df.columns: if properties[x] in k: ax.plot(df[k],label=k) #Clean up and prettify ax.margins(x=0) ax.set_xlabel("Time") ax.set_ylabel(properties[x]) ax.legend(loc='lower right') report.TimeAxis(ax.xaxis) report.Grid(ax) #Save this report out. report.Save()