MCPcopy
hub / github.com/matplotlib/matplotlib / figure_edit

Function figure_edit

lib/matplotlib/backends/qt_editor/figureoptions.py:30–271  ·  view source on GitHub ↗

Edit matplotlib figure options

(axes, parent=None)

Source from the content-addressed store, hash-verified

28
29
30def figure_edit(axes, parent=None):
31 """Edit matplotlib figure options"""
32 sep = (None, None) # separator
33
34 # Get / General
35 def convert_limits(lim, converter):
36 """Convert axis limits for correct input editors."""
37 if isinstance(converter, DateConverter):
38 return map(num2date, lim)
39 # Cast to builtin floats as they have nicer reprs.
40 return map(float, lim)
41
42 axis_map = axes._axis_map
43 axis_limits = {
44 name: tuple(convert_limits(
45 getattr(axes, f'get_{name}lim')(), axis.get_converter()
46 ))
47 for name, axis in axis_map.items()
48 }
49 general = [
50 ('Title', axes.get_title()),
51 sep,
52 *chain.from_iterable([
53 (
54 (None, f"<b>{name.title()}-Axis</b>"),
55 ('Min', axis_limits[name][0]),
56 ('Max', axis_limits[name][1]),
57 ('Label', axis.label.get_text()),
58 ('Scale', [axis.get_scale(),
59 'linear', 'log', 'symlog', 'logit']),
60 sep,
61 )
62 for name, axis in axis_map.items()
63 ]),
64 ('(Re-)Generate automatic legend', False),
65 ]
66
67 # Save the converter and unit data
68 axis_converter = {
69 name: axis.get_converter()
70 for name, axis in axis_map.items()
71 }
72 axis_units = {
73 name: axis.get_units()
74 for name, axis in axis_map.items()
75 }
76
77 # Get / Curves
78 labeled_lines = []
79 for line in axes.get_lines():
80 label = line.get_label()
81 if label == '_nolegend_':
82 continue
83 labeled_lines.append((label, line))
84 curves = []
85
86 def prepare_data(d, init):
87 """

Callers

nothing calls this directly

Calls 15

convert_limitsFunction · 0.85
prepare_dataFunction · 0.85
get_scaleMethod · 0.80
get_unitsMethod · 0.80
get_markerfacecolorMethod · 0.80
get_drawstyleMethod · 0.80
get_markersizeMethod · 0.80
get_arrayMethod · 0.80
get_interpolationMethod · 0.80
get_converterMethod · 0.45
get_titleMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…