Plotting routines¶
Some functionalities are preimplemented to plot dataset in the QT console
Plot an histogram of the data
Example:
>>> def context_menu(self,treeview,position): >>> all_item = get_current_item(self,treeview,single=False) >>> item = all_item[0] >>> list_operations = ['Plot Hist'] >>> action,actions = get_actions(treeview,position,list_operations) >>> if action == actions['Plot Hist']: plot_histogram(self,item,treeview)
Parameters: - item (HDF5TreeItem) – treeview item
- treeview (HDF5TreeWidget) – treeview
- nbins (int, optional) – number of bins in the histogram
Plot a line plot of a single item VS its index
Example:
>>> def context_menu(self,treeview,position): >>> all_item = get_current_item(self,treeview,single=False) >>> item = all_item[0] >>> list_operations = ['Plot Line'] >>> action,actions = get_actions(treeview,position,list_operations) >>> if action == actions['Plot Line']: plot_line(self,item,treeview)
Parameters: - item (HDF5TreeItem) – treeview item
- treeview (HDF5TreeWidget) – treeview
Plot a XY line or scatter plot of two items
Note: You must be able to select multiple items to use this method. So you must create the app with:
>>> app = h5xplorer(extended_selection=True)
Example:
>>> def context_menu(self,treeview,position): >>> all_item = get_current_item(self,treeview,single=False) >>> item0 = all_item[0] >>> item1 = all_item[1] >>> list_operations = ['Plot1D'] >>> action,actions = get_actions(treeview,position,list_operations) >>> if action == actions['Plot1D']: plot1D(self,item0,item1,treeview)
Parameters: - item0 (HDF5TreeItem) – treeview item for the X data
- item1 (HDF5TreeItem) – treeview item for the Y data
- treeview (HDF5TreeWidget) – treeview
- plot (str, optional) – ‘line’ or ‘scatter’
Plot a map of a 2D data array
Example:
>>> def context_menu(self,treeview,position): >>> all_item = get_current_item(self,treeview,single=False) >>> item = all_item[0] >>> list_operations = ['Plot2D'] >>> action,actions = get_actions(treeview,position,list_operations) >>> if action == actions['Plot2D']: plot2D(self,item,treeview)
Parameters: - item (HDF5TreeItem) – treeview item
- treeview (HDF5TreeWidget) – treeview