GetDiscreteLegend

The GetDiscreteLegend function of the mplreport class returns the patches and names required to create a custom legend displaying the colours for discrete property.

This function is usually used along-side GetDiscreteColourMap to visually show discrete values over time.

Parameters
ParameterTypeDefaultMeaning
dtaAQLHistResponseThe AQL query response, usually from FetchHistory.
colstrThe name of the column you want to build a colour map for
Return

Returns a tuple containing two elements.

The first is a list of MatPlotLib Patches in the appropriate colours for each discrete state.

The second is a list of strings, naming each of these patches.

Example
   mydata = report.FetchHistory("'Running' PROPERTY ALLPOINTS")
   legenddata = report.GetDiscreteLegend(mydata,'Machine 1 Running')
   ax.legend(legenddata[0],legenddata[1])