A callback to apply changes.
(data)
| 181 | datalist.append((mappables, "Images, etc.", "")) |
| 182 | |
| 183 | def apply_callback(data): |
| 184 | """A callback to apply changes.""" |
| 185 | orig_limits = { |
| 186 | name: getattr(axes, f"get_{name}lim")() |
| 187 | for name in axis_map |
| 188 | } |
| 189 | |
| 190 | general = data.pop(0) |
| 191 | curves = data.pop(0) if has_curve else [] |
| 192 | mappables = data.pop(0) if has_sm else [] |
| 193 | if data: |
| 194 | raise ValueError("Unexpected field") |
| 195 | |
| 196 | title = general.pop(0) |
| 197 | axes.title.set_text(title) |
| 198 | generate_legend = general.pop() |
| 199 | |
| 200 | for i, (name, axis) in enumerate(axis_map.items()): |
| 201 | axis_min = general[4*i] |
| 202 | axis_max = general[4*i + 1] |
| 203 | axis_label = general[4*i + 2] |
| 204 | axis_scale = general[4*i + 3] |
| 205 | if axis.get_scale() != axis_scale: |
| 206 | getattr(axes, f"set_{name}scale")(axis_scale) |
| 207 | |
| 208 | axis._set_lim(axis_min, axis_max, auto=False) |
| 209 | axis.set_label_text(axis_label) |
| 210 | |
| 211 | # Restore the unit data |
| 212 | axis._set_converter(axis_converter[name]) |
| 213 | axis.set_units(axis_units[name]) |
| 214 | |
| 215 | # Set / Curves |
| 216 | for index, curve in enumerate(curves): |
| 217 | line = labeled_lines[index][1] |
| 218 | (label, linestyle, drawstyle, linewidth, color, marker, markersize, |
| 219 | markerfacecolor, markeredgecolor) = curve |
| 220 | line.set_label(label) |
| 221 | line.set_linestyle(linestyle) |
| 222 | line.set_drawstyle(drawstyle) |
| 223 | line.set_linewidth(linewidth) |
| 224 | rgba = mcolors.to_rgba(color) |
| 225 | line.set_alpha(None) |
| 226 | line.set_color(rgba) |
| 227 | if marker != 'none': |
| 228 | line.set_marker(marker) |
| 229 | line.set_markersize(markersize) |
| 230 | line.set_markerfacecolor(markerfacecolor) |
| 231 | line.set_markeredgecolor(markeredgecolor) |
| 232 | |
| 233 | # Set ScalarMappables. |
| 234 | for index, mappable_settings in enumerate(mappables): |
| 235 | mappable = labeled_mappables[index][1] |
| 236 | if len(mappable_settings) == 6: |
| 237 | label, cmap, low, high, interpolation, interpolation_stage = \ |
| 238 | mappable_settings |
| 239 | mappable.set_interpolation(interpolation) |
| 240 | mappable.set_interpolation_stage(interpolation_stage) |
nothing calls this directly
no test coverage detected
searching dependent graphs…