Plotly version can be found here
Python library for plotting complex functions transformations
- plot complex planes (both transformed and original)
- plot transformations of specific areas (both transformed and original)
- plot lines parallel to real or imaginary axis (both transformed and original)
To plot f(z) = (z+1)/z with x bound from -4 to 4 and y bound from -4 to 4
fromplotcpimportplotcpdeff(z: complex) ->complex: # Define function to plotreturn (z+1) /z# Call plotcp_plt# Second and third arguments define limits of a plotax=plotcp(f, (-4, 4), (-4, 4))For full parameters list check help(plotcp_plt.plotcp_plt)
fromcmathimportsinimportmatplotlib.pyplotaspltimportnumpyasnpfromplotcpimportplot_complex_pointsdeff(z: complex) ->complex: # Define function to plotreturnsin(z)
# Define area to be plottedtop= [x+2*1jforxinnp.linspace(1, 2, 5)]
bottom= [x+1*1jforxinnp.linspace(1, 2, 5)]
left= [1+y*1jforyinnp.linspace(1, 2, 5)]
right= [2+y*1jforyinnp.linspace(1, 2, 5)]
# Plot original areaax=plot_complex_points(top)
ax=plot_complex_points(bottom, ax=ax)
ax=plot_complex_points(left, ax=ax)
ax=plot_complex_points(right, ax=ax)
# Apply function to area and plot it on a new plotax2=plot_complex_points([f(z) forzintop])
ax2=plot_complex_points([f(z) forzinbottom], ax=ax2)
ax2=plot_complex_points([f(z) forzinleft], ax=ax2)
ax2=plot_complex_points([f(z) forzinright], ax=ax2)
plt.show()For full parameters list check help(plotcp.plot_complex_points)