mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
add view function
This commit is contained in:
parent
2dab028a0b
commit
fac368dc7c
@ -1,21 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<MeteoInfo File="milconfig.xml" Type="configurefile">
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\map\projection">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\array"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo"/>
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\plot_types\funny">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo\calc"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\savefig"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\dataframe"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\contour"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\contour"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\streamplot"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\wind"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map\projection"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\funny"/>
|
||||
</Path>
|
||||
<File>
|
||||
<OpenedFiles>
|
||||
@ -24,6 +24,8 @@
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\contour\contour3_1.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\streamplot\streamplot_3.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\streamplot\streamplot_2d_2.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surf_peaks.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\funny\butterfly.py"/>
|
||||
</OpenedFiles>
|
||||
<RecentFiles>
|
||||
<RecentFile File="D:\MyProgram\java\MeteoInfoDev\toolbox\meteoview3d\_reload.py"/>
|
||||
@ -31,6 +33,8 @@
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\contour\contour3_1.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\streamplot\streamplot_3.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\streamplot\streamplot_2d_2.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surf_peaks.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\funny\butterfly.py"/>
|
||||
</RecentFiles>
|
||||
</File>
|
||||
<Font>
|
||||
|
||||
Binary file not shown.
@ -3073,7 +3073,10 @@ def peaks(*args, **kwargs):
|
||||
:return: (*array*) Peaks function result array.
|
||||
"""
|
||||
n = len(args)
|
||||
if n == 1:
|
||||
if n == 0:
|
||||
x = linspace(-3, 3, 49)
|
||||
x, y = meshgrid(x, x)
|
||||
elif n == 1:
|
||||
x = args[0]
|
||||
if isinstance(x, int):
|
||||
x = linspace(-3, 3, x)
|
||||
|
||||
Binary file not shown.
@ -1413,7 +1413,7 @@ class Axes3D(Axes):
|
||||
:param x: (*array_like*) Optional. X coordinate array.
|
||||
:param y: (*array_like*) Optional. Y coordinate array.
|
||||
:param z: (*array_like*) 2-D or 3-D (RGB) z value array.
|
||||
:param levs: (*array_like*) Optional. A list of floating point numbers indicating the level curves
|
||||
:param levels: (*array_like*) Optional. A list of floating point numbers indicating the level curves
|
||||
to draw, in increasing order.
|
||||
:param cmap: (*string*) Color map string.
|
||||
:param colors: (*list*) If None (default), the colormap specified by cmap will be used. If a
|
||||
|
||||
Binary file not shown.
@ -165,6 +165,40 @@ class Axes3DGL(Axes3D):
|
||||
"""
|
||||
self._axes.setAngleX(elevation)
|
||||
|
||||
def view(self, *args):
|
||||
"""
|
||||
Set camera line of sight.
|
||||
|
||||
view(az, el)
|
||||
|
||||
view(dim)
|
||||
|
||||
:param az: (*float*) Azimuth angle.
|
||||
:param el: (*float*) Elevation angle.
|
||||
:param dim: (*int*) Uses the default line of sight for 2-D or 3-D plots. Specify dim as 2
|
||||
for the default 2-D view or 3 for the default 3-D view.
|
||||
|
||||
:return: Current azimuth and elevation angle.
|
||||
"""
|
||||
if len(args) == 1:
|
||||
dim = args[0]
|
||||
if dim == 2:
|
||||
self.set_rotation(0)
|
||||
self.set_elevation(0)
|
||||
elif dim == 3:
|
||||
self.set_rotation(45)
|
||||
self.set_elevation(-45)
|
||||
elif len(args) == 2:
|
||||
az = args[0]
|
||||
el = args[1]
|
||||
self.set_rotation(-az)
|
||||
self.set_elevation(el - 90)
|
||||
|
||||
az = -self.get_rotation()
|
||||
el = self.get_elevation() + 90
|
||||
|
||||
return az, el
|
||||
|
||||
def get_head(self):
|
||||
"""
|
||||
Get head angle.
|
||||
@ -527,10 +561,13 @@ class Axes3DGL(Axes3D):
|
||||
if len(args) < 4:
|
||||
u = args[0]
|
||||
v = args[1]
|
||||
u = np.asarray(u)
|
||||
nz, ny, nx = u.shape
|
||||
x = np.arange(nx)
|
||||
y = np.arange(ny)
|
||||
if isinstance(u, DimArray):
|
||||
y = u.dimvalue(0)
|
||||
x = u.dimvalue(1)
|
||||
else:
|
||||
ny, nx = u.shape
|
||||
x = np.arange(nx)
|
||||
y = np.arange(ny)
|
||||
args = args[2:]
|
||||
else:
|
||||
x = args[0]
|
||||
@ -542,6 +579,12 @@ class Axes3DGL(Axes3D):
|
||||
cdata = args[0]
|
||||
iscolor = True
|
||||
args = args[1:]
|
||||
|
||||
if x.ndim == 2:
|
||||
x = x[0]
|
||||
if y.ndim == 2:
|
||||
y = y[:,0]
|
||||
|
||||
x = plotutil.getplotdata(x)
|
||||
y = plotutil.getplotdata(y)
|
||||
u = plotutil.getplotdata(u)
|
||||
@ -765,9 +808,11 @@ class Axes3DGL(Axes3D):
|
||||
if iscolor:
|
||||
if len(args) > 0:
|
||||
cn = args[0]
|
||||
if isinstance(cn, NDArray):
|
||||
cn = cn.aslist()
|
||||
ls = LegendManage.createLegendScheme(cdata.min(), cdata.max(), cn, cmap)
|
||||
else:
|
||||
levs = kwargs.pop('levs', None)
|
||||
levs = kwargs.pop('levels', None)
|
||||
if levs is None:
|
||||
ls = LegendManage.createLegendScheme(cdata.min(), cdata.max(), cmap)
|
||||
else:
|
||||
@ -1822,7 +1867,7 @@ class Axes3DGL(Axes3D):
|
||||
self.add_graphic(graphics)
|
||||
return graphics
|
||||
|
||||
def view(self):
|
||||
def view_form(self):
|
||||
"""
|
||||
Open GLForm
|
||||
"""
|
||||
|
||||
Binary file not shown.
@ -52,7 +52,7 @@ __all__ = [
|
||||
'right_title', 'refresh', 'savefig', 'savefig_jpeg', 'scatter', 'scatter3', 'scatterm', 'semilogx',
|
||||
'semilogy', 'show', 'slice3', 'stationmodel', 'stem', 'stem3', 'step', 'streamplot', 'streamplot3',
|
||||
'streamplotm', 'streamslice', 'subplot', 'subplots', 'suptitle', 'supxlabel', 'supylabel', 'surf',
|
||||
'surfc', 'taylor_diagram', 'text', 'text3', 'title', 'trisurf', 'twinx', 'twiny', 'violinplot',
|
||||
'surfc', 'taylor_diagram', 'text', 'text3', 'title', 'trisurf', 'twinx', 'twiny', 'view', 'violinplot',
|
||||
'volumeplot', 'weatherspec', 'xaxis', 'xlabel', 'xlim', 'xreverse', 'xticks', 'yaxis', 'ylabel',
|
||||
'ylim', 'yreverse', 'yticks', 'zaxis', 'zlabel', 'zlim', 'zticks', 'isinteractive'
|
||||
]
|
||||
@ -1981,6 +1981,20 @@ def material(mvalues):
|
||||
draw_if_interactive()
|
||||
|
||||
|
||||
@_copy_docstring_and_deprecators(Axes3DGL.view)
|
||||
def view(*args):
|
||||
global g_axes
|
||||
if g_axes is None:
|
||||
g_axes = axes3d()
|
||||
else:
|
||||
if not isinstance(g_axes, Axes3DGL):
|
||||
g_axes = axes3dgl()
|
||||
|
||||
r = g_axes.view(*args)
|
||||
draw_if_interactive()
|
||||
return r
|
||||
|
||||
|
||||
@_copy_docstring_and_deprecators(Axes3D.mesh)
|
||||
def mesh(*args, **kwargs):
|
||||
global g_axes
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user