Plotting

class groundhog.general.plotting.LogPlot(soilprofile, no_panels=1, logwidth=0.05, fillcolordict={'Clay': 'brown', 'Rock': 'grey', 'Sand': 'yellow'}, soiltypelegend=True, **kwargs)[source]

Class for planneled plots with a minilog on the side.

add_trace(x, z, name, panel_no, resetaxisrange=True, **kwargs)[source]

Adds a trace to the plot. By default, lines are added but optional keyword arguments can be added for go.Scatter as **kwargs :param x: Array with the x-values :param z: Array with the z-values :param name: Name for the trace (LaTeX allowed, e.g. r'$ lpha $') :param panel_no: Panel to plot the trace on (1-indexed) :param resetaxisrange: Boolean determining whether the axis range needs to be reset to fit this trace :param kwargs: Optional keyword arguments for the go.Scatter constructor :return: Adds the trace to the specified panel

set_size(width, height)[source]

Adjust the size of the plot :param width: Width of the plot in pixels :param height: Height of the plot in pixels :return: Adjust the height and width as specified

set_xaxis(title, panel_no, **kwargs)[source]

Changes the X-axis title of a panel :param title: Title to be set (LaTeX allowed, e.g. r'$ lpha $') :param panel_no: Panel number (1-indexed) :param kwargs: Additional keyword arguments for the axis layout update function, e.g. range=(0, 100) :return: Adjusts the X-axis of the specified panel

set_zaxis(title, **kwargs)[source]

Changes the Z-axis :param title: Title to be set (LaTeX allowed, e.g. r'$ lpha $') :param kwargs: Additional keyword arguments for the axis layout update function, e.g. range=(0, 100) :return: Adjusts the Z-axis

groundhog.general.plotting.generate_html(outpath, figures, titles, drawnby, report, fignos, rev, projecttitle, subtitle1s, subtitle2s=None, subtitle3s=None, subtitle4s=None, checkedby=None, figure_date='19/04/2021', filename='figures', portraitformat=True, print_message=True)[source]

Returns HTML for a series of Plotly portrait figures. The figures are first coerced to the correct format (portrait: H=870 x W=702, landscape: H=600 x W=1050). Standardized font and colors are also set.

Parameters
  • outpath – Path where the output is written. Use absolute paths.

  • figures – List of Plotly figures

  • titles – List of titles for the figures (maximum 90 characters)

  • drawnby – Initials of drawer (maximum 3 characters)

  • report – Report number (maximum 15 characters)

  • fignos – List with figure numbers (maximum 12 characters)

  • rev – Revision of the figures (maximum 2 characters)

  • date – Date of drawing in %d/%m/%Y format

  • projecttitle – Title of the project (maximum 95 characters)

  • subtitle1s – List with first subtitles (maximum 120 characters)

  • subtitle2s – List with second subtitles (maximum 120 characters) - default is None

  • subtitle3s – List with third subtitles (maximum 120 characters) - default is None

  • subtitle4s – List with fourth subtitles (maximum 120 characters) - default is None

  • checkedby – Initials of the checker (maximum 3 characters)

  • filename – Filename for the output, ‘figures’ by default

  • portraitformat – Boolean determining whether the figure is portrait or landscape format

  • print_message – Defines whether a message is returned to the user

Returns

Writes a file with HTML code to the specified output path

groundhog.general.plotting.plot_with_log(x=[[]], z=[[]], names=[[]], showlegends=None, modes=None, markerformats=None, soildata=None, fillcolordict={'CLAY': 'brown', 'ROCK': 'grey', 'SAND': 'yellow', 'SILT': 'green'}, colors=None, logwidth=0.05, xtitles=[], ztitle=None, xranges=None, zrange=None, ztick=None, dticks=None, layout={}, showfig=True)[source]

Plots a given number of traces in a plot with a soil mini-log on the left hand side. The traces are given as a list of lists, the traces are grouped per plotting panel. For example x=[[np.linspace(0, 1, 100), np.logspace(0,2,100)], [np.linspace(1, 3, 100), ]] leads to the first two traces plotted in the first panel and one trace in the second panel. The same goes for the z arrays, trace names, …

Parameters
  • x – List of lists of x-arrays for the traces

  • z – List of lists of z-arrays for the traces

  • names – List of lists of names for the traces (used in legend)

  • showlegends – Array of booleans determining whether or not to show the trace in the legend

  • modes – List of display modes for the traces (select from ‘lines’, ‘markers’ or ‘lines+markers’

  • markerformats – List of formats for the markers (see Plotly docs for more info)

  • soildata – Pandas dataframe with keys ‘Soil type’: Array with soil type for each layer, ‘Depth from [m]’: Array with start depth for each layer, ‘Depth to [m]’: Array with bottom depth for each layer

  • fillcolordict – Dictionary with fill colours (default yellow for ‘SAND’, brown from ‘CLAY’ and grey for ‘ROCK’)

  • colors – List of colours to be used for plotting (default = default Plotly colours)

  • logwidth – Width of the soil width as a ratio of the total plot with (default = 0.05)

  • xtitles – Array with X-axis titles for the panels

  • ztitle – Depth axis title (Depth axis is shared between all panels)

  • xranges – List with ranges to be used for X-axes

  • zrange – Range to be used for Y-axis

  • ztick – Tick interval to be used for the Y-axis

  • dticks – List of tick intervals to be used for the X-axes

  • layout – Dictionary with the layout settings

  • showfig – Boolean determining whether the figure needs to be shown

Returns

Plotly figure object which can be further modified