ColortableRegistry¶
-
class
metpy.plots.ctables.
ColortableRegistry
[source]¶ Manages the collection of color tables.
Provides access to color tables, read collections of files, and generates matplotlib’s Normalize instances to go with the colortable.
Methods Summary
add_colortable
(fobj, name)Add a color table from a file to the registry. clear
()copy
()fromkeys
Returns a new dict with keys from iterable and values equal to value. get
(k[,d])get_colortable
(name)Get a color table from the registry. get_with_boundaries
(name, boundaries)Get a color table from the registry with a corresponding norm. get_with_range
(name, start, end)Get a color table from the registry with a corresponding norm. get_with_steps
(name, start, step)Get a color table from the registry with a corresponding norm. items
()keys
()pop
(k[,d])If key is not found, d is returned if given, otherwise KeyError is raised popitem
()2-tuple; but raise KeyError if D is empty. scan_dir
(path)Scan a directory on disk for color table files and add them to the registry. scan_resource
(pkg, path)Scan a resource directory for colortable files and add them to the registry. setdefault
(k[,d])update
([E, ]**F)If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k] values
()Methods Documentation
-
add_colortable
(fobj, name)[source]¶ Add a color table from a file to the registry.
Parameters: - fobj (file-like object) – The file to read the color table from
- name (str) – The name under which the color table will be stored
-
clear
() → None. Remove all items from D.¶
-
copy
() → a shallow copy of D¶
-
fromkeys
()¶ Returns a new dict with keys from iterable and values equal to value.
-
get
(k[, d]) → D[k] if k in D, else d. d defaults to None.¶
-
get_colortable
(name)[source]¶ Get a color table from the registry.
Parameters: name (str) – The name under which the color table will be stored Returns: matplotlib.colors.ListedColormap
– The color table corresponding to name
-
get_with_boundaries
(name, boundaries)[source]¶ Get a color table from the registry with a corresponding norm.
Builds a
matplotlib.colors.BoundaryNorm
using boundaries.Parameters: - name (str) – The name under which the color table will be stored
- boundaries (array_like) – The list of boundaries for the norm
Returns: matplotlib.colors.BoundaryNorm
,matplotlib.colors.ListedColormap
– The boundary norm based on boundaries, and the color table itself.
-
get_with_range
(name, start, end)[source]¶ Get a color table from the registry with a corresponding norm.
Builds a
matplotlib.colors.BoundaryNorm
using start, end, and the number of colors, based on the color table obtained from name.Parameters: Returns: matplotlib.colors.BoundaryNorm
,matplotlib.colors.ListedColormap
– The boundary norm based on start and end with the number of colors from the number of entries matching the color table, and the color table itself.
-
get_with_steps
(name, start, step)[source]¶ Get a color table from the registry with a corresponding norm.
Builds a
matplotlib.colors.BoundaryNorm
using start, step, and the number of colors, based on the color table obtained from name.Parameters: Returns: matplotlib.colors.BoundaryNorm
,matplotlib.colors.ListedColormap
– The boundary norm based on start and step with the number of colors from the number of entries matching the color table, and the color table itself.
-
items
() → a set-like object providing a view on D's items¶
-
keys
() → a set-like object providing a view on D's keys¶
-
pop
(k[, d]) → v, remove specified key and return the corresponding value.¶ If key is not found, d is returned if given, otherwise KeyError is raised
-
popitem
() → (k, v), remove and return some (key, value) pair as a¶ 2-tuple; but raise KeyError if D is empty.
-
scan_dir
(path)[source]¶ Scan a directory on disk for color table files and add them to the registry.
Parameters: path (str) – The path to the directory with the color tables
-
scan_resource
(pkg, path)[source]¶ Scan a resource directory for colortable files and add them to the registry.
Parameters:
-
setdefault
(k[, d]) → D.get(k,d), also set D[k]=d if k not in D¶
-
update
([E, ]**F) → None. Update D from dict/iterable E and F.¶ If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
-
values
() → an object providing a view on D's values¶
-