Spaces:
Runtime error
Runtime error
Update src/reporter/docx_fill.py
Browse files76 unmodified lines777879808182838476 unmodified linesdef wrap_label(s: str, width: int = 14) -> str:return "\n".join(textwrap.wrap(str(s), width=width, break_long_words=False))def radar_chart(names: List[str], auto_vals: List[float], valut_vals: List[float], out_png: Path) -> None:"""Radar con 2 sole serie (AUTO vs VALUT).Nota estetica: niente aree piene (o riempimento quasi trasparente) per evitare l'effetto76 unmodified lines777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818976 unmodified linesdef wrap_label(s: str, width: int = 14) -> str:return "\n".join(textwrap.wrap(str(s), width=width, break_long_words=False))def radar_chart(names: List[str], auto_vals: List[float], valut_vals: List[float], out_png: Path) -> None:""" Radar con 2 sole serie (AUTO vs VALUT) """labels = [wrap_label(n, 18) for n in names]n = len(labels)angles = np.linspace(0, 2 * np.pi, n, endpoint=False).tolist()angles += angles[:1]a = list(auto_vals) + [auto_vals[0]]v = list(valut_vals) + [valut_vals[0]]fig = plt.figure(figsize=(14.6, 8.6), dpi=220)fig.patch.set_facecolor("white")ax = plt.subplot(111, polar=True)ax.set_facecolor("white")ax.set_theta_offset(np.pi / 2)ax.set_theta_direction(-1)ax.set_ylim(0, 6)ax.set_xticks(angles[:-1])ax.set_xticklabels(labels, fontsize=10.3)ax.tick_params(axis="x", pad=30)ax.set_rlabel_position(18)ax.set_yticks([1, 2, 3, 4, 5, 6])ax.set_yticklabels(["1", "2", "3", "4", "5", "6"], fontsize=9.2, alpha=0.52)ax.spines["polar"].set_linewidth(1.0)ax.spines["polar"].set_alpha(0.16)ax.yaxis.grid(True, alpha=0.14, linewidth=0.9)ax.xaxis.grid(True, alpha=0.08, linewidth=0.8)line1, = ax.plot(angles, v,linewidth=2.9,solid_capstyle="round",solid_joinstyle="round",marker="o",markersize=8.5,markeredgewidth=1.2,label="Valutazione",zorder=4)line2, = ax.plot(angles, a,linewidth=2.9,solid_capstyle="round",solid_joinstyle="round",marker="o",markersize=8.5,markeredgewidth=1.2,label="Autovalutazione",zorder=4)c1 = line1.get_color()c2 = line2.get_color()line1.set_markerfacecolor(c1)line1.set_markeredgecolor("white")line2.set_markerfacecolor(c2)line2.set_markeredgecolor("white")ax.fill(angles, v, color=c1, alpha=0.055, zorder=2)ax.fill(angles, a, color=c2, alpha=0.055, zorder=2)# halo bianco sotto ai markerax.scatter(angles[:-1], v[:-1], s=520, color="white", edgecolors="none", zorder=5)ax.scatter(angles[:-1], a[:-1], s=520, color="white", edgecolors="none", zorder=5)# marker grandiax.scatter(angles[:-1], v[:-1],s=310, color=c1,edgecolors="white", linewidth=1.9, zorder=6)ax.scatter(angles[:-1], a[:-1],s=310, color=c2,edgecolors="white", linewidth=1.9, zorder=6)fig.subplots_adjust(left=0.05, right=0.72, top=0.96, bottom=0.08)legend = ax.legend(loc="center left",bbox_to_anchor=(1.20, 0.56),frameon=True,fancybox=True,framealpha=1.0,borderpad=1.05,labelspacing=1.0,handlelength=2.5,handletextpad=0.85,fontsize=11.2,numpoints=1,)frame = legend.get_frame()frame.set_facecolor("white")frame.set_edgecolor("#E2E8F0")frame.set_linewidth(0.9)fig.savefig(out_png, transparent=True, bbox_inches="tight", pad_inches=0.24)plt.close(fig)def radar_chart_old(names: List[str], auto_vals: List[float], valut_vals: List[float], out_png: Path) -> None:"""Radar con 2 sole serie (AUTO vs VALUT).Nota estetica: niente aree piene (o riempimento quasi trasparente) per evitare l'effetto
src/reporter/docx_fill.py+106-1