straditize.widgets.plots module¶
Plot control widgets for straditize
Copyright (C) 2018-2019 Philipp S. Sommer
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Classes
|
A widget for controlling the plot |
|
A widget to control the plots |
|
A widget for plotting the final results |
-
class
straditize.widgets.plots.
PlotControl
(straditizer_widgets, item, *args, **kwargs)[source]¶ Bases:
straditize.widgets.StraditizerControlBase
,PyQt5.QtWidgets.QWidget
A widget for controlling the plot
This widgets holds a
PlotControlTable
to display visual diagnostics in the plot. Additionally it contains zoom buttons (btn_view_global
andbtn_view_data
) and a widget to plot the results (results_plot
)Attributes
A button to zoom to the data
A button to zoom out to the entire stratigraphic diagram
A
ResultsPlot
to plot the digitized data in a new diagramA
PlotControlTable
to display visual diagnosticsMethods
refresh
()Refresh from the straditizer
setup_children
(item)Setup the children for this control
Zoom to the data part
Zoom out to the full straditgraphic diagram
-
btn_view_data
= None¶ A button to zoom to the data (see
zoom_data()
)
-
btn_view_global
= None¶ A button to zoom out to the entire stratigraphic diagram (see
zoom_global()
)
-
results_plot
= None¶ A
ResultsPlot
to plot the digitized data in a new diagram
-
setup_children
(item)[source]¶ Setup the children for this control
This method is called to setup the children in the
StraditizerWidgets.tree
. By default, it just creates a child QTreeWidgetItem and sets this control as it’s widget- Parameters
item (QTreeWidgetItem) – The top level item in the
StraditizerWidgets.tree
-
table
= None¶ A
PlotControlTable
to display visual diagnostics
-
-
class
straditize.widgets.plots.
PlotControlTable
(straditizer_widgets, *args, **kwargs)[source]¶ Bases:
straditize.widgets.StraditizerControlBase
,PyQt5.QtWidgets.QTableWidget
A widget to control the plots
This control widget is a table to plot, remove and toggle the visiblity of visual diagnostics for the straditizer. It has two columns: the first to toggle the visibility of the plot, the second to plot and remove the matplotlib artists. The vertical header are the items in the corresponding
plot_funcs
,can_be_plotted_funcs
and/orhide_funcs
.Rows are added to this table using the
add_item()
method which stores the plotting functions in theplot_funcs
and the functions to hide the plot in thehide_funcs
. Whether an item can be plotted or not depends on the results of the corresponding callable in thecan_be_plotted_funcs
.Methods
add_item
(what, get_artists[, plot_func, …])Add a plot object to the table
Test whether the column starts can be visualized
Test whether the box around the diagram part can be plotted
Test if the reader color image can be plotted
Test whether the full_df can be plotted
Test whether potential sample regions can be plotted
Test whether the sample lines can be plotted
Test whether the samples can be plotted
draw_figs
(artists)Draw the figures of the given artists
b is ignored and is always set to True
Get the artists of the column starts
Get the plotted
straditize.straditizer.Straditizer.data_box
Get the
straditize.binary.DataReader.color_plot_im
Get the artists of the full_df plot
Get the artists of the plot of potential samples
Get the plotted the sample lines
Get the artists of the plotted samples
Get the
straditize.straditizer.Straditizer.plot_im
Plot horizontal lines for the column starts
Plot the data box around the diagram part
Plot the data reader color image
Plot the
full_df
of the readerHighlight the regions with potential samples in the plot
Plot the horizontal sample lines of the reader
Plot the samples of the reader
refresh
()Refresh from the straditizer
Remove the plotted lines of the column starts
Remove the box around the diagram part
Remove the
straditize.binary.DataReader.color_plot_im
Remove the plot of the full_df
Remove the plot of potential samples
Remove the sample lines
Remove the plotted samples
Check if a widget should be enabled
sizeHint
(self)Attributes
A mapping from plot identifier to a callable that returns
True
ifBuilt-in mutable sequence.
A mapping from plot identifier to a callable to hide the corresponding
A mapping from plot identifier to a callable to plot the corresponding
Built-in mutable sequence.
-
add_item
(what, get_artists, plot_func=None, remove_func=None, can_be_plotted=None)[source]¶ Add a plot object to the table
- Parameters
what (str) – The description of the plot object
get_artists (function) – A function that takes no arguments and returns the artists
plot_func (function, optional) – A function that takes no arguments and makes the plot.
remove_func (function, optional) – A function that takes no arguments and removes the plot.
can_be_plotted (function, optional) – A function that takes no argument and returns True if the plot can be made.
-
can_be_plotted_funcs
= {}¶ A mapping from plot identifier to a callable that returns
True
if the corresponding function in theplot_funcs
mapping can be called
-
col_lines
= []¶
-
draw_figs
(artists)[source]¶ Draw the figures of the given artists
- Parameters
artists (list of
matplotlib.artist.Artist
) – The artists to draw the canvas from
-
hide_funcs
= {}¶ A mapping from plot identifier to a callable to hide the corresponding artists
-
plot_funcs
= {}¶ A mapping from plot identifier to a callable to plot the corresponding artists
-
remove_data_reader_color_image
()[source]¶ Remove the
straditize.binary.DataReader.color_plot_im
See also
-
should_be_enabled
(w)[source]¶ Check if a widget should be enabled
This function checks if a given widget w from the
widgets2disable
attribute should be enabled or not- Parameters
w (QWidget) – The widget to check
- Returns
True, if the widget should be enabled
- Return type
-
property
widgets2disable
¶ Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.
-
-
class
straditize.widgets.plots.
ResultsPlot
(straditizer_widgets)[source]¶ Bases:
straditize.widgets.StraditizerControlBase
A widget for plotting the final results
This widgets contains a QPushButton
btn_plot
to plot the results using thestraditize.binary.DataReader.plot_results()
methodAttributes
The QPushButton to call the
plot_results()
methodA QCheckBox whether the samples or the full digitized data shall be
A QCheckBox whether x- and y-axis should be translated from pixel to
Methods
Plot the results
refresh
()Refresh from the straditizer
setup_children
(item)Setup the children for this control
-
btn_plot
= None¶ The QPushButton to call the
plot_results()
method
-
cb_final
= None¶ A QCheckBox whether the samples or the full digitized data shall be plotted
-
cb_transformed
= None¶ A QCheckBox whether x- and y-axis should be translated from pixel to data units
-
plot_results
()[source]¶ Plot the results
What is plotted depends on the
cb_transformed
and thecb_final
cb_transformed
andcb_final
are checkedcb_transformed
is checked but notcb_final
cb_transformed
is not checked butcb_final
cb_transformed
andcb_final
are both not checkedPlot the
straditize.binary.DataReader.full_df
-
setup_children
(item)[source]¶ Setup the children for this control
This method is called to setup the children in the
StraditizerWidgets.tree
. By default, it just creates a child QTreeWidgetItem and sets this control as it’s widget- Parameters
item (QTreeWidgetItem) – The top level item in the
StraditizerWidgets.tree
-