Commit 8fa0cdb 1 parent 010389c commit 8fa0cdb Copy full SHA for 8fa0cdb
File tree 2 files changed +16
-4
lines changed
2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 8
8
automatically add a plot title, axis titles, and a colour bar when appropriate.
9
9
10
10
These also have the optional kwarg ``footer``, which adds text to the bottom right of
11
- the plot figure.
11
+ the plot figure. For security classifications, the enum :class:`Classifications`
12
+ can be used for common usages.
12
13
13
14
See also: :ref:`matplotlib <matplotlib:users-guide-index>`.
14
15
15
16
"""
16
17
18
+ from enum import StrEnum
19
+
17
20
import cf_units
18
21
from matplotlib import patheffects
19
22
import matplotlib .pyplot as plt
23
26
import iris .plot as iplt
24
27
25
28
29
+ class Classification (StrEnum ):
30
+ official = "Official"
31
+ official_sensitive = "Official-Sensitive"
32
+ secret = "Secret"
33
+ top_secret = "Top Secret"
34
+
35
+
26
36
def _use_symbol (units ):
27
37
# For non-time units use the shortest unit representation.
28
38
# E.g. prefer 'K' over 'kelvin', but not '0.0174532925199433 rad'
Original file line number Diff line number Diff line change @@ -283,9 +283,11 @@ def test_vertical(self):
283
283
284
284
@_shared_utils .skip_plot
285
285
class TestFooter :
286
- def test__footer (self ):
287
- text = "Example"
286
+ @pytest .mark .parametrize (
287
+ "text" , [qplt .Classification .official_sensitive , "Example" ]
288
+ )
289
+ def test__footer (self , text ):
290
+ fig = plt .figure ()
288
291
qplt ._footer (text )
289
- fig = plt .gcf ()
290
292
footer_text = fig .texts [0 ].get_text ()
291
293
assert text == footer_text
You can’t perform that action at this time.
0 commit comments