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:
- 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:
- classmethod graph_legend(ax=None, handles=None, labels=None, **kwargs)[source]
Add a USGS-style legend to a matplotlib axis object
- classmethod graph_legend_title(leg, title=None, fontsize=9)[source]
Set the legend title for a matplotlib legend 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:
- 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.
- classmethod xlabel(ax=None, label='', bold=False, italic=False, **kwargs)[source]
Method to set the xlabel using the styled fontdict