PLOTS View2dΒΆ

# -*-Python-*-
# Created by smithsp at 11 Jul 2018  11:51

"""
This script demonstrates the use of View2d

Contents extracted/reordered from regression/test_OMFITplot.py

"""

# examples from View2d docstring
print('Testing View2d...')
x = linspace(-1, 1, 200)
y = linspace(-2, 2, 200)
xx, yy = meshgrid(x, y)
z = np.exp(-(xx ** 2) - yy ** 2)
# basic View2d test
# v = View2d(z)
# gcf().canvas.set_window_title('Test basic View2d()')

# add more meaningful labels to the axes
# v = View2d(z, coords={'x': x, 'y': y}, dims=('x', 'y'), name='wow')
# gcf().canvas.set_window_title('Test View2d() with axis labels')

# or use the xarray integration
d = DataArray(z, coords={'x': x, 'y': y}, dims=('x', 'y'), name='wow')
v = View2d(d)
gcf().canvas.set_window_title('Test View2d() with xarray integration')

# test the side-plot slicing
# v.vslice(-0.25, 0)
# v.hslice(0, 0.5)#, std=True)
# and now test the buttons
# for key in ['d/d-x', 'd/d-y', 'int-x', 'int-y', 'data']:
#    print('   Testing View2d button: {}'.format(key))
#    v._radio_select(key)