src.utils.plot module#
- src.utils.plot.get_fig(RN, CN, FW=None, FH=None, AW=None, AH=None, A_ratio=1.0, LM=3, RM=3, TM=3, BM=3, HS=None, VS=None, dpi=300, fontsize=7, lw=0.5, gridspec=False, font_family='DejaVu Sans', **kwargs)[source]#
- src.utils.plot.plot_resilience(f: callable, extent=(0, 1, 0, 1), gridnum=(1000, 1000), cmap=None, norm=None, ax=None, reset_xylim=True, lw=1)[source]#
Plot the resilience of a 2D function. - f: 2D function, such as lambda x, y: y - 3*y**2 - y**3 + x*y**3 - extent: Function domain (xmin, xmax, ymin, ymax) - gridnum: Grid resolution (xnum, ynum) — Example: >>> f = lambda x, y: y - 3*y**2 - y**3 + x*y**3 >>> plot_resilience(f, ax=axes[0], extent=(0, 5, 0, 5)) >>> f = lambda x, y: np.sin(np.sqrt(x**2 + y ** 2)) >>> plot_resilience(f, ax=axes[1], extent=(-4*np.pi, 4*np.pi, -4*np.pi, 4*np.pi)) >>> f = lambda x, y: np.sin(np.sqrt(x ** 2 + y ** 2)) * x - y * np.cos(np.sqrt(x ** 2 + y ** 2)) >>> plot_resilience(f, ax=axes[2], extent=(-4*np.pi, 4*np.pi, -4*np.pi, 4*np.pi))
- class src.utils.plot.EqualizeNormalize(*args: Any, **kwargs: Any)[source]#
Bases:
NormalizeNormalize by distribution rather than raw value.
- src.utils.plot.plotOD(ax, source: List[str], destination: List[str], flow: List[float], location: Dict[str, Tuple[float, float]], linetype: Literal['straight', 'parabola', 'rotated_parabola', 'projected_parabola'] = 'straight', N=100, zorder=10, **kwargs)[source]#
Plot OD flow.
- src.utils.plot.clear_svg(path, debug=False)[source]#
SVG files generated by matplotlib may use syntax like <text style=”font: 9.8px ‘Arial’; text-anchor: middle” x=”80.307802” y=”193.900483”>2020-02-02</text>, while PowerPoint cannot recognize the shorthand form font: 9.8px ‘Arial’; and only supports forms such as font-family: ‘Arial’; font-size: 9.8px;. Therefore, conversion is required. The handled properties include: - font-size - font-family - font-weight - font-style
- src.utils.plot.load_font()[source]#
plt.title(“Example Chart: Square of Numbers”, fontproperties=font, size=15)
plt.xlabel(“Number”, fontproperties=font, size=12)
plt.ylabel(“Square”, fontproperties=font, size=12)