MCPcopy Create free account
hub / github.com/PJLab-ADG/OASim / plot_ttc_version_2

Function plot_ttc_version_2

limsim/evaluation/ttc_test.py:33–72  ·  view source on GitHub ↗
(ttc_statistics)

Source from the content-addressed store, hash-verified

31
32
33def plot_ttc_version_2(ttc_statistics) -> None:
34 fig, ax = plt.subplots(1, 1, figsize=(6, 4))
35 x, y = ttc_statistics[:, 0], ttc_statistics[:, 1]
36 ax.plot(x, y, linewidth=2, label="ttc")
37
38 ax.legend()
39
40 # partial enlargement
41 axins = inset_axes(ax,
42 width="40%",
43 height="30%",
44 loc='lower right',
45 bbox_to_anchor=(0.1, 0.1, 1, 1),
46 bbox_transform=ax.transAxes)
47
48 axins.plot(
49 x,
50 y,
51 linewidth=2,
52 )
53
54 zone_left = 256
55 zone_right = 260
56
57 x_ratio = 0.5 # x轴显示范围的扩展比例
58 y_ratio = 0.5 # y轴显示范围的扩展比例
59
60 xlim0 = x[zone_left] - (x[zone_right] - x[zone_left]) * x_ratio
61 xlim1 = x[zone_right] + (x[zone_right] - x[zone_left]) * x_ratio
62
63 ylim0 = 2.5
64 ylim1 = 20 * y_ratio
65
66 axins.set_xlim(xlim0, xlim1)
67 axins.set_ylim(ylim0, ylim1)
68
69 # connect the zoom-in area
70 mark_inset(ax, axins, loc1=3, loc2=1, fc="none", ec='k', lw=1)
71
72 plt.show()
73
74
75def plot_ttc_version_3(ttc_statistics):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected