geolib_plus.plot_plotting package¶
geolib_plus.plot_cpt module¶
- geolib_plus.plot_cpt.define_inclination_ticks_and_labels(cpt: AbstractCPT, depth: np.ndarray, inclination: np.ndarray, ylim: List, settings: Dict) Tuple[np.ndarray, List] ¶
Defines the location and the labels of the ticks referring to the inclination angle with respect to the depth of the cpt. The first tick is at the reference level, the following ticks are spaced exactly 1 meter apart. The tick label is defined as the average inclination over the 1 meter above the tick.
- Parameters:
cpt –
depth –
inclination –
ylim –
settings –
- Returns:
- geolib_plus.plot_cpt.generate_plot(cpt: AbstractCPT, settings: Dict, ylim: List, ylims: List, plot_nr: int) plt.Figure ¶
Plots cpt data within vertical limits
- Parameters:
cpt – cpt data
settings – general settings
ylim – current vertical limit
ylims – all vertical limits for the current cpt data
plot_nr – number of the plot within the current cpt data
- Returns:
- geolib_plus.plot_cpt.get_values_which_exceed_threshold(threshold: List, values: ndarray, y_data: ndarray, show_interval: float) Tuple[ndarray, ndarray] ¶
Gets the values which exceed the given threshold which has to be shown, where a value is shown if the distance regarding the previous shown value is greater than the show interval and the value exceeds the threshold.
- Parameters:
threshold – Threshold values of plotted data
values – Plotted data
y_data – Depth data
show_interval – Min distance between shown values
- Return shown_values:
Values past threshold which are shown in text boxes
- Return y_coord_shown_value:
Vertical coordinates of the shown_values
- geolib_plus.plot_cpt.get_y_lims(cpt: AbstractCPT, settings: Dict) List ¶
Gets all the vertical plot limits of the cpt. If the length of the cpt exceeds the vertical limit of the plot, a new plot is generated. The top of the new plot is the bottom of the previous plot plus the repeated distance
- Parameters:
cpt –
settings –
- Returns:
- geolib_plus.plot_cpt.plot_cpt_norm(cpt: AbstractCPT, output_folder: Path, settings: Dict)¶
Plots and saves all data in the current cpt according to the norm written in NEN 22476-1
- Parameters:
cpt – cpt data
settings – general settings
- Returns:
- geolib_plus.plot_cpt.save_figures(figures: List, cpt: AbstractCPT, output_folder: Path)¶
Saves all plots of current cpt in one pdf file
- Parameters:
fig – current figure
ylims – all vertical limits of current cpt
cpt – cpt data
plot_nr – number of the plot
- Returns:
- geolib_plus.plot_cpt.trim_cpt_data(settings: Dict, vertical_settings: Dict, cpt: AbstractCPT, y_lim: List) Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray] ¶
Trims the requested cpt data (qc ,friction, friction nbr, water) at threshold values and vertical limits.
- Parameters:
settings – graph settings
vertical_settings – the vertical settings
cpt – cpt data
y_lim – vertical limit of current graph
- Return trimmed_values:
Trimmed cpt data at cut off values
- Return shown_values:
Values past threshold which are shown in text boxes
- Return y_coord_shown_value:
Vertical coordinates of the shown_values
- Return depth_in_range:
Vertical coordinates within y limits
- Return inclination_in_range:
Inclination angle within y limits
- geolib_plus.plot_cpt.trim_cpt_data_on_vertical_limits(cpt: AbstractCPT, y_lim: List, settings: Dict) Tuple[np.ndarray, np.ndarray, np.ndarray] ¶
Trims the cpt data on the vertical limits.
- Parameters:
cpt – cpt data
y_lim – vertical limit of current graph
settings – graph settings
- Returns:
- geolib_plus.plot_cpt.trim_values_at_exceeding_threshold(threshold: List, values: ndarray) ndarray ¶
Trims a graph on threshold values when the threshold is exceeded.
- Parameters:
threshold –
values –
- Return trimmed values:
geolib_plus.plot_settings module¶
- class geolib_plus.plot_settings.PlotSettings¶
- assign_default_settings()¶
Assigns the default plot settings :return:
- property label_positions¶
Position of the label in the plot, options are: 0 = ‘top_left’, 1 = ‘top_right’, 2 = ‘bottom_left’, 3 = ‘bottom_right’, 4 = ‘bottom_middle’,
- property languages¶
Language of the plot, options are: 0 = ‘Nederlands’, 1 = ‘English’
- property plot_sizes¶
Size of the plot, options are: 0 = ‘a4’; 1 = ‘unlimited’;
- set_friction_number_in_plot()¶
Removes inverse friction number from the plot and sets the friction number in the plot :return:
- set_inversed_friction_number_in_plot()¶
Removes friction number from the plot and sets the inverse friction number in the plot :return:
- property top_types¶
Type of the top level of the plot, options are: 0 = ‘relative’ : the top of the plot is relative to the surface level; 1 = ‘absolute’ : the top of the plot is an absolute value;
When the PlotSettings
class is initialised, the class is filled with default settings.
However, the user might want to change the default settings. Below an overview is given on how to change the default settings.
The plot settings are built up out of several dictionaries. Below an explanation is given of the dictionaries.
All the settings are stored in general_settings
. It is recommended to
not change the settings in the variable, besides the language and the font size of the labels. Below an example is given
how to change this.
from geolib_plus.plot_settings import PlotSettings
plot_settings = PlotSettings()
# set language to english
plot_settings.general_settings["language"] = plot_settings.languages[1]
# set font size of the labels
plot_settings.general_settings["font_size_labels"] = 10
The cpt plotter allows for 5 different data fields: cone resistance, friction resistance, friction number,
inversed friction number and pore pressure. The settings for these data fields can be altered in the dictionaries:
plot_qc_settings
, plot_friction_settings
,
plot_friction_nbr_settings
, plot_inv_friction_nbr_settings
and
plot_water_settings
.
Below a code snippet is presented on how to change cone resistance settings
from geolib_plus.plot_settings import PlotSettings
plot_settings = PlotSettings()
# Set minimum and maximum threshold for shown values, data which surpasses these tresholds is cut off at the
# respective threshold. The units are equal to the units read from the input file in this case it is in MPa
plot_settings.plot_qc_settings["threshold"] = [0, 30]
# Sets the colour of the graph
plot_settings.plot_qc_settings["graph_color"] = "blue"
# Sets the style of the line
plot_settings.plot_qc_settings["line_style"] = "--"
# Sets the scale of the shown graph. This value represents how much of the respective unit (in this case MPa) is shown
# per 2 grid cells.
plot_settings.plot_qc_settings["scale_unit"] = 3
# Shifts the graph away from the vertical axis. The unit is the same as read from the data, in this case MPa. Note that
# the absolute shift is based on the scale unit.
plot_settings.plot_qc_settings["shift_graph"] = 1
# Sets the ticks at the x-axis. In this case, from 0 to 30 (not including 30) with a step size of 5
plot_settings.plot_qc_settings["ticks"] = np.arange(0, 30, 5).tolist()
Besides the horizontal data settings, also the vertical settings related to the depth can be altered. Below a code snipped is shown on how to alter the vertical settings:
from geolib_plus.plot_settings import PlotSettings
plot_settings = PlotSettings()
# sets the type of the top level, top_types[0] for relative top level, top_types[1] for absolute top level
plot_settings.vertical_settings["top_type"] = plot_settings.top_types[1]
# Absolute value in meter, of the top of the first graph. This value is used if top type is absolute.
plot_settings.vertical_settings["absolute_top_level"] = 5
# Rounded down value of the distance in meter above surface level. This value is used if top type is relative.
plot_settings.vertical_settings["buffer_at_top"] = 1.5
# Vertical length of the graph in meter
plot_settings.vertical_settings["length_graph"] = 1.5
# The distance in meter which is repeated from one graph to the subsequent graph (in case the data exceeds the bottom
# of the graph).
plot_settings.vertical_settings["repeated_distance"] = 1.5
# Distance in meter of the depth ticks
plot_settings.vertical_settings["depth_tick_distance"] = 1.5
# Distance in meter of the inclination ticks if present
plot_settings.vertical_settings["inclination_tick_distance"] = 1.5
# Minimal distance in meter between textboxes which show values which exceed the data threshold.
plot_settings.vertical_settings["spacing_shown_cut_off_value"] = 1.5
Lastly the grid can be altered. It is possible to alter the line distances, the line colours and the line widths. Below a code snippet is shown which shows how to alter the grid settings. Note that the grid by default refers to the axis related to the cone resistance data. Therefore the scales of the grid are equal to the scales of the cone resistance data. The unit is MPa.
from geolib_plus.plot_settings import PlotSettings
plot_settings = PlotSettings()
# Sets the locations of the major grid lines, relative to the cone resistance data
plot_settings.grid["vertical_major_line_locations"] = [10, 20, 30]
# Sets the colour of the major grid lines
plot_settings.grid["vertical_major_line_color"] = "black"
# Sets the line width of the major grid lines
plot_settings.grid["vertical_major_line_line_width"] = 1.5
# sets the distances between minor vertical lines, relative to the cone resistance data. In this case
# there are 2 sets off minor vertical lines
plot_settings.grid["vertical_minor_line_distances"] = [2, 1]
# Sets the colours of all the sets of minor vertical lines
plot_settings.grid["vertical_minor_line_colors"] = ['black', 'black']
# Sets the line widths of all the sets of minor vertical lines
plot_settings.grid["vertical_minor_line_line_widths"] = [1, 0.5]
# Sets the colour of the major grid lines
plot_settings.grid["horizontal_major_line_color"] = "black"
# Sets the line width of the major grid lines
plot_settings.grid["horizontal_major_line_line_width"] = 1.5
# Sets the locations of the major grid lines, relative to the depth data.
plot_settings.grid["horizontal_major_line_locations"] = [-2, -10]
# sets the distances between horizontal lines, relative to the depth data. In this case
# there are 2 sets off horizontal lines
plot_settings.grid["horizontal_line_distances"] = [2, 1]
# Sets the colours of all the sets of minor vertical lines
plot_settings.grid["horizontal_line_colors"] = ['black', 'black']
# Sets the line widths of all the sets of horizontal lines
plot_settings.grid["horizontal_line_line_widths"] = [1, 0.5]
geolib_plus.plot_utils module¶
- geolib_plus.plot_utils.create_bro_information_box(ax: Axes, scale: float, cpt: Any, plot_nr: int, ylims: List[Tuple[float, float]], distance_meta_data_from_plot: float) None ¶
- Parameters:
ax – current axis
scale – scale of the plot on the paper
cpt – cpt data
plot_nr – number of the plot within the current cpt data
ylims – all vertical limits for the current cpt data
distance_meta_data_from_plot – The distance between the meta data table and the actual plot
- Returns:
- geolib_plus.plot_utils.create_custom_grid(ax: Axes, xlim: List[float], ylim: List[float], grid: Dict[str, Any]) None ¶
Creates custom grid with custom line colours, custom line distances and custom line widths
- Parameters:
ax – current axis
xlim – horizontal limit
ylim – vertical limit
grid – grid settings
- Returns:
- geolib_plus.plot_utils.create_gef_information_box(ax: Axes, scale: float, cpt: Any, plot_nr: int, ylims: List[Tuple[float, float]]) None ¶
Sets textboxes with meta data
- Parameters:
ax – current axis
scale – scale of the plot on the paper
cpt – cpt data
plot_nr – number of the plot within the current cpt data
ylims – all vertical limits for the current cpt data
- Returns:
- geolib_plus.plot_utils.create_information_box(ax: Axes, scale: float, cpt: Any, plot_nr: int, ylims: List[Tuple[float, float]], distance_from_plot: float) None ¶
- geolib_plus.plot_utils.create_predrilled_depth_line_and_box(cpt: Any, ax: Axes, xlim: List[float], language: str) None ¶
Sets a black line at the left most side of the plot from the local_reference_level to the local_reference_level - predrilled_depth. Also sets a textbox with the depth of the predrilled depth. This should only happen if the predrilled depth is present and more than 0.5 m.
- Parameters:
ax – current axis
cpt – cpt data
xlim – horizontal limit
language – language of the plot
- Returns:
- geolib_plus.plot_utils.set_figure_size(fig: Any, ylim: List[float]) None ¶
Sets the figure size in inches
- Parameters:
fig – current figure
ylim – current vertical limit
- Returns:
- geolib_plus.plot_utils.set_local_reference_line(cpt: Any, ax: Axes, xlim: List[float], language: str) None ¶
Sets a line in the plot at the depth of the local reference line, e.g. surface level or sea bed level. Also set a textbox with the depth of the reference line relative to the vertical datum.
- Parameters:
cpt –
ax –
xlim –
language –
- Returns:
- geolib_plus.plot_utils.set_multicolor_label(ylim: List[float], ax: Axes, label_txt: str, color: str, font_size_text: int, font_size_arrow: int, line_style: str, x_axis_type: str, location: str = 'bottom_left', axis: str = 'x', anchorpad: int = 0, extra_label_spacing: float = 0.02, **kw: Any) None ¶
This function creates axes labels with multiple colors
- Parameters:
ylim – vertical limit of current plot
ax – current axis where the labels should be drawn
label_txt – text in label
color – color of label
font_size_text – font size of the text
font_size_arrow – font size of the arrow in the label
line_style – style of the line of the current graph
location – location of the label relative to the plot
axis – ‘x’, ‘y’, or ‘both’ and specifies which label(s) should be drawn
anchorpad – pad around the child for drawing a frame. given in fraction of fontsize.
kw – key word arguments for TextArea
- Returns:
- geolib_plus.plot_utils.set_textbox_at_thresholds(ax: Axes, ylim: List, max_data: ndarray, found_depths_data: ndarray, threshold: List, location: str)¶
Set textboxes in the plot at the location off maximum values past the cut off value.
- Parameters:
ax – axis
ylim – vertical limit
max_data – maximum values past the cut off value
found_depths_data – depths of maximum values past the cut of value
threshold – value at which the data is cut off
location – location of axis label and ticks
- Returns:
- geolib_plus.plot_utils.set_x_axis(ax: Axes, graph: Dict[str, Any], settings: Dict[str, Any], ylim: List[float]) None ¶
Sets the x-limit, the x-label, and the x-ticks
- Parameters:
ax –
graph –
settings –
- Returns:
- geolib_plus.plot_utils.set_y_axis(ax: Axes, ylim: List[float], settings: Dict[str, Any], cpt: Any, tick_locations_inclination: List[float], tick_labels_inclination: List[str]) None ¶
Sets the y-limit, the y-label, the y-ticks and inverts y-axis
- Parameters:
ax –
ylim –
settings –
cpt –
- Returns: