In [1]:
#general imports 
import pygslib



In [2]:
#get the data in gslib format into a pandas Dataframe
mydata= pygslib.gslib.read_gslib_file('../datasets/cluster.dat')

In [3]:
parameters = {
        'hmin' : None,                          #in/output rank-0 array(float,'d')
        'hmax' : None,                         #in/output rank-0 array(float,'d')
        'ncl'  : 30,                            #int, number of bins
        'iwt'  : 1,                             #int, 1 use declustering weight
        'ilog' : 1,                             #int, 1 use logscale
        'icum' : 0,                             #int, 1 use cumulative
        'va'   : mydata['Primary'],             # array('d') with bounds (nd)
        'wt'   : None,                          # array('d') with bounds (nd), wight variable (obtained with declust?)
        'figure' : None ,                       # a bokeh figure object (Optional: new figure created if None). Set none or undefined if creating a new figure. 
        'title'  : 'A test',                    # string. Figure title
        'xlabel' : 'Grade', # string. X axis label 
        'ylabel' : 'f(%)', # string. Y axis label
        # visual parameter for the histogram
        'color' : 'red', # string with valid CSS colour (https://www.w3schools.com/colors/colors_names.asp), or an RGB(A) hex value, or tuple of integers (r,g,b), or tuple of (r,g,b,a) 
        'legend': 'Non - Declustered', # string (Optional, default "NA")
        'alpha' :  0.5, # float [0-1]. Transparency of the fill colour 
        'lwidth': 1, # float. Line width
        # legend 
        'legendloc': 'top_left'}

In [4]:
res, fig = pygslib.plothtml.histgplt(parameters)

In [5]:
# show the figure
pygslib.plothtml.show(fig)



In [6]:
# note that parameters was updated
parameters['figure']


Out[6]:
Figure(
id = 'eb4ee984-a6c9-4f21-80cf-705ae4ed111d', …)

In [7]:
#append another histogram but declustered
parameters['wt']= mydata['Declustering Weight']
parameters['color']= 'blue'
parameters['legend'] = 'Declustered'
res, fig = pygslib.plothtml.histgplt(parameters)
pygslib.plothtml.show(fig)



In [8]:
# you can do some edits
fig.title.text = "@@@@@@ new name  @@@@@@"
pygslib.plothtml.show(fig)



In [ ]: