Skip to content

Commit

Permalink
feat: Add arctan2 example
Browse files Browse the repository at this point in the history
Signed-off-by: Sietze van Buuren <[email protected]>
  • Loading branch information
swvanbuuren committed Nov 9, 2024
1 parent 7ff201a commit 513589a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions examples/arctan2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
Surface plot of arctan2 function
"""

import numpy as np
import mlpyqtgraph as mpg


@mpg.plotter(antialiasing=True)
def main():
""" Examples with surface plots """
extent = 4
nx = 48
ny = 48
amplitude = 0.5
x = np.linspace(-extent, extent, nx)
y = np.linspace(-extent, extent, ny)
z = np.zeros((nx, ny))
for i in range(ny):
z[i, :] = amplitude * np.arctan2(x, y[i])

mpg.figure(title='arctan2(x, y)', layout_type='Qt')
mpg.surf(x, y, z, colormap='viridis', projection='orthographic')


if __name__ == '__main__':
main()

0 comments on commit 513589a

Please sign in to comment.