watex.view.QuickPlot#

class watex.view.QuickPlot(classes=None, tname=None, mapflow=False, **kws)[source]#

Special class dealing with analysis modules for quick diagrams, histograms and bar visualizations.

Originally, it was designed for the flow rate prediction, however, it still works with any other dataset by following the parameters details.

Parameters:
  • data (str, filepath_or_buffer or pandas.core.DataFrame) – Path -like object or Dataframe. If data is given as path-like object, data is read, asserted and validated. Any valid string path is acceptable. The string could be a URL. Valid URL schemes include http, ftp, s3, gs, and file. For file URLs, a host is expected. A local file could be a file://localhost/path/to/table.csv. If you want to pass in a path object, pandas accepts any os.PathLike. By file-like object, we refer to objects with a read() method, such as a file handle e.g. via builtin open function or StringIO.

  • y (array-like of shape (M, ) :math:`M=m-samples) – train target; Denotes data that may be observed at training time as the dependent variable in learning, but which is unavailable at prediction time, and is usually the target of prediction.

  • tname (str,) – A target name or label. In supervised learning the target name is considered as the reference name of y or label variable.

  • classes (list of int | float, [categorized classes]) –

    list of the categorial values encoded to numerical. For instance, for flow data analysis in the Bagoue dataset, the classes could be [0., 1., 3.] which means:

    * 0 m3/h  --> FR0
    * > 0 to 1 m3/h --> FR1
    * > 1 to 3 m3/h --> FR2
    * > 3 m3/h  --> FR3
    

  • mapflow (bool,) –

    Is refer to the flow rate prediction using DC-resistivity features and work when the tname is set to flow. If set to True, value in the target columns should map to categorical values. Commonly the flow rate values are given as a trend of numerical values. For a classification purpose, flow rate must be converted to categorical values which are mainly refered to the type of types of hydraulic. Mostly the type of hydraulic system is in turn tided to the number of the living population in a specific area. For instance, flow classes can be ranged as follow:

    • FR = 0 is for dry boreholes

    • 0 < FR ≤ 3m3/h for village hydraulic (≤2000 inhabitants)

    • 3 < FR ≤ 6m3/h for improved village hydraulic(>2000-20 000inhbts)

    • 6 <FR ≤ 10m3/h for urban hydraulic (>200 000 inhabitants).

    Note that the flow range from mapflow is not exhaustive and can be modified according to the type of hydraulic required on the project.

  • savefig (str, Path-like object,) – savefigure’s name, default is None

  • fig_dpi (float,) – dots-per-inch resolution of the figure. default is 300

  • fig_num (int,) – size of figure in inches (width, height). default is [5, 5]

  • fig_size (Tuple (int, int) or inch) – size of figure in inches (width, height).*default* is [5, 5]

  • fig_orientation (str,) – figure orientation. default is landscape

  • fig_tile (str,) – figure title. default is None

  • fs (float,) – size of font of axis tick labels, axis labels are fs+2. default is 6

  • ls (str,) – line style, it can be [ ‘-’ | ‘.’ | ‘:’ ] . default is ‘-’

  • lc (str, Optional,) – line color of the plot, default is k

  • lw (float, Optional,) – line weight of the plot, default is 1.5

  • alpha (float between 0 < alpha < 1,) – transparency number, default is 0.5,

  • font_weight (str, Optional) – weight of the font , default is bold.

  • font_style (str, Optional) – style of the font. default is italic

  • font_size (float, Optional) – size of font in inches (width, height). default is 3.

  • ms (float, Optional) – size of marker in points. default is 5

  • marker (str, Optional) – marker of stations default is o.

  • marker_style (str, Optional) – facecolor of the marker. default is yellow

  • marker_edgecolor (str, Optional) – facecolor of the marker. default is yellow

  • marker_edgewidth (float, Optional) – width of the marker. default is 3.

  • xminorticks (float, Optional) – minortick according to x-axis size and default is 1.

  • yminorticks (float, Optional) – yminorticks according to x-axis size and default is 1.

  • bins (histograms element separation between two bar. default is 10.) –

  • xlim (tuple (int, int), Optional) – limit of x-axis in plot.

  • ylim (tuple (int, int), Optional) – limit of x-axis in plot.

  • xlabel (str, Optional,) – label name of x-axis in plot.

  • ylabel (str, Optional,) – label name of y-axis in plot.

  • rotate_xlabel (float, Optional) – angle to rotate xlabel in plot.

  • rotate_ylabel (float, Optional) – angle to rotate ylabel in plot.

  • leg_kws (dict, Optional) – keyword arguments of legend. default is empty dict

  • plt_kws (dict, Optional) – keyword arguments of plot. default is empty dict

  • glc (str, Optional) – line color of the grid plot, default is k

  • glw (float, Optional) – line weight of the grid plot, default is 2

  • galpha (float, Optional,) – transparency number of grid, default is 0.5

  • gaxis (str ('x', 'y', 'both')) – type of axis to hold the grid, default is both

  • gwhich (str, Optional) – kind of grid in the plot. default is major

  • tp_axis (bool,) – axis to apply the ticks params. default is both

  • tp_labelsize (str, Optional) – labelsize of ticks params. default is italic

  • tp_bottom (bool,) – position at bottom of ticks params. default is True.

  • tp_labelbottom (bool,) – put label on the bottom of the ticks. default is False

  • tp_labeltop (bool,) – put label on the top of the ticks. default is True

  • cb_orientation (str , ('vertical', 'horizontal')) – orientation of the colorbar, default is vertical

  • cb_aspect (float, Optional) – aspect of the colorbar. default is 20.

  • cb_shrink (float, Optional) – shrink size of the colorbar. default is 1.0

  • cb_pad (float,) – pad of the colorbar of plot. default is .05

  • cb_anchor (tuple (float, float)) – anchor of the colorbar. default is (0.0, 0.5)

  • cb_panchor (tuple (float, float)) – proportionality anchor of the colorbar. default is (1.0, 0.5)

  • cb_label (str, Optional) – label of the colorbar.

  • cb_spacing (str, Optional) – spacing of the colorbar. default is uniform

  • cb_drawedges (bool,) – draw edges inside of the colorbar. default is False

  • sns_orient ('v' | 'h', optional) – Orientation of the plot (vertical or horizontal). This is usually inferred based on the type of the input variables, but it can be used to resolve ambiguity when both x and y are numeric or when plotting wide-form data. default is v which refer to ‘vertical’

  • sns_style (dict, or one of {darkgrid, whitegrid, dark, white, ticks}) – A dictionary of parameters or the name of a preconfigured style.

  • sns_palette (seaborn color paltte | matplotlib colormap | hls | husl) – Palette definition. Should be something color_palette() can process. the palette generates the point with different colors

  • sns_height (float,) – Proportion of axes extent covered by each rug element. Can be negative. default is 4.

  • sns_aspect (scalar (float, int)) – Aspect ratio of each facet, so that aspect * height gives the width of each facet in inches. default is .7

Returns:

self – returns self for easy method chaining.

Return type:

Baseclass instance

Examples

>>> from watex.view.plot import  QuickPlot
>>> data = 'data/geodata/main.bagciv.data.csv'
>>> qkObj = QuickPlot(  leg_kws= dict( loc='upper right'),
...          fig_title = '`sfi` vs`ohmS|`geol`',
...            )
>>> qkObj.tname='flow' # target the DC-flow rate prediction dataset
>>> qkObj.mapflow=True  # to hold category FR0, FR1 etc..
>>> qkObj.fit(data)
>>> sns_pkws= dict ( aspect = 2 ,
...          height= 2,
...                  )
>>> map_kws= dict( edgecolor="w")
>>> qkObj.discussingfeatures(features =['ohmS', 'sfi','geol', 'flow'],
...                           map_kws=map_kws,  **sns_pkws
...                         )