flopy.plot.styles module¶
-
class
styles
[source]¶ Bases:
object
Styles class for custom matplotlib styling
The class contains both custom styles and plotting methods for custom formatting using a specific matplotlib style
Additional styles can be easily added to the mplstyle folder and accessed using the plt.style.context() method.
-
classmethod
add_annotation
(ax=None, text='', xy=None, xytext=None, bold=True, italic=True, fontsize=9, ha='left', va='bottom', **kwargs)[source]¶ Add an annotation to a axis object
Parameters: - ax (axis object) – matplotlib axis object (default is None)
- text (str) – text string
- xy (tuple) – tuple with the location of the annotation (default is None)
- xytext (tuple) – tuple with the location of the text
- bold (bool) – boolean indicating if bold font (default is True)
- italic (bool) – boolean indicating if italic font (default is True)
- fontsize (int) – font size (default is 9 points)
- ha (str) – matplotlib horizontal alignment keyword (default is left)
- va (str) – matplotlib vertical alignment keyword (default is bottom)
- kwargs (dict) – dictionary with valid matplotlib annotation object keywords
Returns: ann_obj – matplotlib annotation object
Return type: object
-
classmethod
add_text
(ax=None, text='', x=0.0, y=0.0, transform=True, bold=True, italic=True, fontsize=9, ha='left', va='bottom', **kwargs)[source]¶ Add USGS-style text to a axis object
Parameters: - ax (axis object) – matplotlib axis object (default is None)
- text (str) – text string
- x (float) – x-location of text string (default is 0.)
- y (float) – y-location of text string (default is 0.)
- transform (bool) – boolean that determines if a transformed (True) or data (False) coordinate system is used to define the (x, y) location of the text string (default is True)
- bold (bool) – boolean indicating if bold font (default is True)
- italic (bool) – boolean indicating if italic font (default is True)
- fontsize (int) – font size (default is 9 points)
- ha (str) – matplotlib horizontal alignment keyword (default is left)
- va (str) – matplotlib vertical alignment keyword (default is bottom)
- kwargs (dict) – dictionary with valid matplotlib text object keywords
Returns: text_obj – matplotlib text object
Return type: object
-
classmethod
graph_legend
(ax=None, handles=None, labels=None, **kwargs)[source]¶ Add a USGS-style legend to a matplotlib axis object
Parameters: - ax (axis object) – matplotlib axis object (default is None)
- handles (list) – list of legend handles
- labels (list) – list of labels for legend handles
- kwargs (kwargs) – matplotlib legend kwargs
Returns: leg – matplotlib legend object
Return type: object
-
classmethod
graph_legend_title
(leg, title=None)[source]¶ Set the legend title for a matplotlib legend object
Parameters: - leg (legend object) – matplotlib legend object
- title (str) – title for legend
Returns: leg – matplotlib legend object
Return type: object
-
classmethod
heading
(ax=None, letter=None, heading=None, x=0.0, y=1.01, idx=None, fontsize=9)[source]¶ Add a USGS-style heading to a matplotlib axis object
Parameters: - ax (axis object) – matplotlib axis object (default is None)
- letter (str) – string that defines the subplot (A, B, C, etc.)
- heading (str) – text string
- x (float) – location of the heading in the x-direction in normalized plot dimensions ranging from 0 to 1 (default is 0.00)
- y (float) – location of the heading in the y-direction in normalized plot dimensions ranging from 0 to 1 (default is 1.01)
- idx (int) – index for programatically generating the heading letter when letter is None and idx is not None. idx = 0 will generate A (default is None)
Returns: text – matplotlib text object
Return type: object
-
classmethod
remove_edge_ticks
(ax=None)[source]¶ Remove unnecessary ticks on the edges of the plot
Parameters: ax (axis object) – matplotlib axis object (default is None) Returns: ax – matplotlib axis object Return type: axis object
-
classmethod
set_font_type
(family, fontname)[source]¶ Method to set the matplotlib font type for the current style
Note: this method only works when adding text using the styles methods.
Parameters: - family (str) – matplotlib.rcparams font.family
- font (str) – matplotlib.rcparams font.fontname
Returns: Return type: None
-
classmethod
xlabel
(ax=None, label='', bold=False, italic=False, **kwargs)[source]¶ Method to set the xlabel using the styled fontdict
Parameters: - ax (axis object) – matplotlib axis object (default is None)
- label (str) – axis label for the chart
- bold (bool) – flag to switch to boldface test
- italic (bool) – flag to use italic text
- kwargs (dict) – keyword arguments for the matplotlib set_xlabel method
Returns: Return type: None
-
classmethod
ylabel
(ax=None, label='', bold=False, italic=False, **kwargs)[source]¶ Method to set the ylabel using the styled fontdict
Parameters: - ax (axis object) – matplotlib axis object (default is None)
- label (str) – axis label for the chart
- bold (bool) – flag to switch to boldface test
- italic (bool) – flag to use italic text
- kwargs (dict) – keyword arguments for the matplotlib set_xlabel method
Returns: Return type: None
-
classmethod