mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
update axis method in 3D axes
This commit is contained in:
parent
81c824ebf3
commit
77660473f9
@ -23,14 +23,12 @@
|
||||
<OpenedFile File="D:\MyProgram\java\MeteoInfoDev\toolbox\meteoview3d\mainGUI.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surfc_1.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\mesh\meshc_peaks.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\map\test_shaperead-2.py"/>
|
||||
</OpenedFiles>
|
||||
<RecentFiles>
|
||||
<RecentFile File="D:\MyProgram\java\MeteoInfoDev\toolbox\meteoview3d\_reload.py"/>
|
||||
<RecentFile File="D:\MyProgram\java\MeteoInfoDev\toolbox\meteoview3d\mainGUI.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surfc_1.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\mesh\meshc_peaks.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\map\test_shaperead-2.py"/>
|
||||
</RecentFiles>
|
||||
</File>
|
||||
<Font>
|
||||
@ -38,5 +36,5 @@
|
||||
</Font>
|
||||
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
|
||||
<Figure DoubleBuffering="true"/>
|
||||
<Startup MainFormLocation="-7,-7" MainFormSize="1293,685"/>
|
||||
<Startup MainFormLocation="-7,0" MainFormSize="1383,767"/>
|
||||
</MeteoInfo>
|
||||
|
||||
Binary file not shown.
@ -288,26 +288,97 @@ class Axes3D(Axes):
|
||||
zmax = miutil.date2num(zmax)
|
||||
self._axes.setZMinMax(zmin, zmax)
|
||||
|
||||
def axis(self, limits):
|
||||
def set_axis_on(self):
|
||||
"""
|
||||
Sets the min and max of the x,y, axes, with ``[xmin, xmax, ymin, ymax, zmin, zmax]`` .
|
||||
Set all axis visible.
|
||||
"""
|
||||
self._axes.setDrawBase(True)
|
||||
self._axes.setBoxed(True)
|
||||
self._axes.setDisplayXY(True)
|
||||
self._axes.setDisplayZ(True)
|
||||
|
||||
:param limits: (*list*) Min and max of the x,y,z axes.
|
||||
def set_axis_off(self):
|
||||
"""
|
||||
if len(limits) == 6:
|
||||
xmin = limits[0]
|
||||
xmax = limits[1]
|
||||
ymin = limits[2]
|
||||
ymax = limits[3]
|
||||
zmin = limits[4]
|
||||
zmax = limits[5]
|
||||
extent = Extent3D(xmin, xmax, ymin, ymax, zmin, zmax)
|
||||
self._axes.setDrawExtent(extent)
|
||||
self._axes.setAxesExtent(extent.clone())
|
||||
return True
|
||||
Set all axis not visible.
|
||||
"""
|
||||
self._axes.setDrawBase(False)
|
||||
self._axes.setBoxed(False)
|
||||
self._axes.setDisplayXY(False)
|
||||
self._axes.setDisplayZ(False)
|
||||
|
||||
def axis(self, arg=None, **kwargs):
|
||||
"""
|
||||
Convenience method to get or set some axis properties.
|
||||
|
||||
Call signatures::
|
||||
xmin, xmax, ymin, ymax = axis()
|
||||
xmin, xmax, ymin, ymax = axis([xmin, xmax, ymin, ymax])
|
||||
xmin, xmax, ymin, ymax = axis(option)
|
||||
xmin, xmax, ymin, ymax = axis(**kwargs)
|
||||
|
||||
Parameters
|
||||
----------
|
||||
xmin, xmax, ymin, ymax, zmin, zmax : float, optional
|
||||
The axis limits to be set. This can also be achieved using ::
|
||||
ax.set(xlim=(xmin, xmax), ylim=(ymin, ymax), zlim=(zmin, zmax))
|
||||
|
||||
option : bool or str
|
||||
If a bool, turns axis lines and labels on or off. If a string,
|
||||
possible values are:
|
||||
======== ==========================================================
|
||||
Value Description
|
||||
======== ==========================================================
|
||||
'on' Turn on axis lines and labels. Same as ``True``.
|
||||
'off' Turn off axis lines and labels. Same as ``False``.
|
||||
'equal' Set equal scaling (i.e., make circles circular) by
|
||||
changing axis limits. This is the same as
|
||||
``ax.set_aspect('equal', adjustable='datalim')``.
|
||||
Explicit data limits may not be respected in this case.
|
||||
'scaled' Set equal scaling (i.e., make circles circular) by
|
||||
changing dimensions of the plot box. This is the same as
|
||||
``ax.set_aspect('equal', adjustable='box', anchor='C')``.
|
||||
Additionally, further autoscaling will be disabled.
|
||||
'tight' Set limits just large enough to show all data, then
|
||||
disable further autoscaling.
|
||||
'auto' Automatic scaling (fill plot box with data).
|
||||
'image' 'scaled' with axis limits equal to data limits.
|
||||
'square' Square plot; similar to 'scaled', but initially forcing
|
||||
``xmax-xmin == ymax-ymin``.
|
||||
======== ==========================================================
|
||||
|
||||
Returns
|
||||
-------
|
||||
xmin, xmax, ymin, ymax, zmin, zmax : float
|
||||
The axis limits.
|
||||
"""
|
||||
if isinstance(arg, (str, bool)):
|
||||
if arg is True:
|
||||
arg = 'on'
|
||||
if arg is False:
|
||||
arg = 'off'
|
||||
arg = arg.lower()
|
||||
if arg == 'on':
|
||||
self.set_axis_on()
|
||||
elif arg == 'off':
|
||||
self.set_axis_off()
|
||||
elif arg in ['auto', 'equal']:
|
||||
self.set_aspect(arg)
|
||||
else:
|
||||
raise ValueError("Unrecognized string {} to axis; "
|
||||
"try 'on' or 'off'".format(arg))
|
||||
else:
|
||||
print('The limits parameter must be a list with 6 elements: xmin, xmax, ymin, ymax, zmin, zmax!')
|
||||
return None
|
||||
if arg is not None:
|
||||
try:
|
||||
xmin, xmax, ymin, ymax, zmin, zmax = arg
|
||||
except (TypeError, ValueError) as err:
|
||||
raise TypeError('the first argument to axis() must be an '
|
||||
'iterable of the form '
|
||||
'[xmin, xmax, ymin, ymax, zmin, zmax]')
|
||||
self.set_xlim(xmin, xmax)
|
||||
self.set_ylim(ymin, ymax)
|
||||
self.set_zlim(zmin, zmax)
|
||||
|
||||
return self.get_xlim() + self.get_ylim() + self.get_zlim()
|
||||
|
||||
def set_zlabel(self, label, **kwargs):
|
||||
"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user