Commit 7dc7d622 authored by Christian Rohlfing's avatar Christian Rohlfing

- Abtastung: Bugfix for labels/legend entries

- Primer Komplexe Zahlen: Added phase plot
parent 2405b10f
......@@ -127,14 +127,6 @@
" fGdirac = f[np.where(G)]; Gdirac = G[np.where(G)]\n",
" if s_type == 'sin-Funktion':\n",
" Sadirac = np.imag(Sadirac); Sdirac = np.imag(Sdirac); S = lambda f: np.imag(signals_f[s_type](f, F)); Sa = np.imag(Sa); G = np.imag(G); Gdirac = np.imag(Gdirac)\n",
" axs[1].lines[1].set_label(r'$\\mathrm{Im}\\{S_\\mathrm{a}(f)\\}$'); axs[1].lines[-3].set_label(r'$\\mathrm{Im}\\{S(f)\\}$');\n",
" axs[1].legend(loc=2);\n",
" axs[2].set_ylabel(r'$\\uparrow \\mathrm{Im}\\{G(f)\\}$');\n",
" else:\n",
" if axs[1].lines:\n",
" axs[1].lines[1].set_label(r'$S_\\mathrm{a}(f)$'); axs[1].lines[-3].set_label(r'$S(f)$')\n",
" axs[1].legend(loc=2)\n",
" axs[2].set_ylabel(r'$\\uparrow G(f)$');\n",
" else:\n",
" g /= (len(f)/(2*f[-1])) # Parseval :)\n",
" \n",
......@@ -195,6 +187,15 @@
" axs[2].lines[0].set_ydata(G);\n",
" axs[3].lines[0].set_ydata(s(t))\n",
" axs[3].lines[1].set_ydata(g);\n",
" # Adapt labels\n",
" if s_type == 'sin-Funktion':\n",
" axs[1].lines[1].set_label(r'$\\mathrm{Im}\\{S_\\mathrm{a}(f)\\}$'); axs[1].lines[-3].set_label(r'$\\mathrm{Im}\\{S(f)\\}$');\n",
" axs[2].set_ylabel(r'$\\uparrow \\mathrm{Im}\\{G(f)\\}$');\n",
" else:\n",
" axs[1].lines[1].set_label(r'$S_\\mathrm{a}(f)$'); axs[1].lines[-3].set_label(r'$S(f)$')\n",
" axs[2].set_ylabel(r'$\\uparrow G(f)$');\n",
" axs[1].legend(loc=2)\n",
" \n",
" ient_update_ylim(axs[1], Sa, 0.19, np.max(Sa)); ient_update_ylim(axs[2], G, 0.19, np.max(G));\n",
" ient_update_ylim(axs[3], np.concatenate((s(t),g)), 0.19, np.max(np.concatenate((s(t),g))));"
]
......
......@@ -93,7 +93,7 @@
" ax = axs[0,0]; ient_axis(ax); ax.axis('equal');\n",
" an = np.linspace(0, 2 * np.pi, 100); ax.plot(np.cos(an), np.sin(an), 'black-50')\n",
" ax.annotate(\"\", xy=(np.real(s0),np.imag(s0)), xytext=(0, 0), arrowprops=arrow_args)\n",
" ax.set_xlabel(r'$\\rightarrow \\mathrm{Re}\\{s(t_0)\\}$'); ax.set_ylabel(r'$\\uparrow \\mathrm{Im}\\{s(t_0)\\}$')\n",
" ax.set_xlabel(r'$\\rightarrow \\mathrm{Re}\\{s(t)\\}$'); ax.set_ylabel(r'$\\uparrow \\mathrm{Im}\\{s(t)\\}$')\n",
" \n",
" # Imaginary part\n",
" ax = axs[0,1]; ax.plot(t, np.imag(s), 'black-50'); ax.plot(t0, np.imag(s0), **highlight_args); ient_axis(ax);\n",
......@@ -103,13 +103,21 @@
" ax = axs[1,0]; ax.plot(np.real(s),t, 'black-50'); ax.plot(np.real(s0), t0, **highlight_args); ient_axis(ax);\n",
" ax.set_ylabel(r'$\\downarrow t$'); ax.set_xlabel(r'$\\rightarrow \\mathrm{Re}\\{s(t)\\}$', bbox=ient_wbbox); \n",
" ax.invert_yaxis(); ax.set_zorder(-1)\n",
" axs[1,1].set_visible(False); fig.tight_layout(); # hide last axis and tighten layout\n",
" \n",
" # Angle\n",
" #axs[1,1].set_visible(False); \n",
" ax = axs[1,1]\n",
" ax.plot(t, np.angle(s), 'black-50'); ax.plot(t0, np.angle(s0), **highlight_args); ient_axis(ax);\n",
" ax.set_xlabel(r'$\\rightarrow t$'); ax.set_ylabel(r'$\\uparrow \\angle\\{s(t)\\}$'); ax.set_zorder(-1)\n",
" ax.set_yticks([-np.pi, np.pi]); ax.yaxis.set_ticklabels([r'$-\\pi$', r'$\\pi$'])\n",
" fig.tight_layout(); # hide last axis and tighten layout\n",
" else: # update plots\n",
" annotations = [child for child in axs[0,0].get_children() if isinstance(child, matplotlib.text.Annotation)]\n",
" annotations[0].remove()\n",
" axs[0,0].annotate(\"\", xy=(np.real(s0),np.imag(s0)), xytext=(0, 0), arrowprops=arrow_args)\n",
" axs[0,1].lines[1].set_xdata(t0); axs[0,1].lines[1].set_ydata(np.imag(s0))\n",
" axs[1,0].lines[1].set_ydata(t0); axs[1,0].lines[1].set_xdata(np.real(s0))\n",
" axs[1,1].lines[1].set_xdata(t0); axs[1,1].lines[1].set_ydata(np.angle(s0))\n",
" annotations = [child for child in axs[0,0].get_children() if isinstance(child, matplotlib.patches.ConnectionPatch)]\n",
" if len(annotations): annotations[0].remove(); annotations[1].remove();\n",
" if show_lines:\n",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment