the plotting functions in miplot support MapAxes

This commit is contained in:
wyq 2024-04-08 09:23:16 +08:00
parent 260a7f20d6
commit 98e0f1f67c
9 changed files with 39 additions and 34 deletions

View File

@ -67,7 +67,7 @@ import java.util.zip.ZipInputStream;
public static String getVersion(){
String version = GlobalUtil.class.getPackage().getImplementationVersion();
if (version == null || version.equals("")) {
version = "3.8.4";
version = "3.8.5";
}
return version;
}

View File

@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<MeteoInfo File="milconfig.xml" Type="configurefile">
<Path OpenPath="D:\Run\emips\run_chengdu">
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth"/>
<Path OpenPath="D:\Working\MIScript\Jython\mis\plot_types\arrow">
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\model"/>
@ -16,19 +14,21 @@
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\netcdf"/>
<RecentFolder Folder="D:\Run\emips\run_chengdu"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\arrow"/>
</Path>
<File>
<OpenedFiles>
<OpenedFile File="D:\Working\MIScript\Jython\mis\map\geoshow\geoshow_2.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\geotiff\geotiff_dem_4.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\netcdf\ncwrite_crs_1.py"/>
<OpenedFile File="D:\Run\emips\run_chengdu\run_pollutants_test_crs.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\arrow\arrow_map.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\arrow\arrow_1.py"/>
</OpenedFiles>
<RecentFiles>
<RecentFile File="D:\Working\MIScript\Jython\mis\map\geoshow\geoshow_2.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\io\geotiff\geotiff_dem_4.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\io\netcdf\ncwrite_crs_1.py"/>
<RecentFile File="D:\Run\emips\run_chengdu\run_pollutants_test_crs.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\arrow\arrow_map.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\arrow\arrow_1.py"/>
</RecentFiles>
</File>
<Font>

View File

@ -8,7 +8,7 @@ def get_pressure(wrfin, timeidx=0):
object in order to perform the calculation.
:param wrfin: (*DimDataFile*) Data file.
:param timeidx: (*int*) Time index.
:param timeidx: (*int*) Time index. Default is `0`.
:returns: (*array*) Pressure (hPa).
"""

View File

@ -96,7 +96,8 @@ class Axes(object):
xreverse = kwargs.pop('xreverse', False)
yreverse = kwargs.pop('yreverse', False)
xaxistype = kwargs.pop('xaxistype', None)
bgcobj = kwargs.pop('bgcolor', None)
facecolor = kwargs.pop('bgcolor', None)
facecolor = kwargs.pop('facecolor', facecolor)
if aspect == 'equal':
self._axes.setAspectType(AspectType.EQUAL)
@ -120,8 +121,9 @@ class Axes(object):
r_axis.setInverse(True)
if not xaxistype is None:
self.set_xaxis_type(xaxistype)
bgcolor = plotutil.getcolor(bgcobj)
self._axes.setBackground(bgcolor)
if facecolor is not None:
facecolor = plotutil.getcolor(facecolor)
self._axes.setBackground(facecolor)
tickline = kwargs.pop('tickline', None)
if not tickline is None:
b_axis.setDrawTickLine(tickline)

View File

@ -151,7 +151,7 @@ def step(x, y, *args, **kwargs):
if g_axes is None:
g_axes = axes()
else:
if g_axes.axestype != 'cartesian' and g_axes.axestype != 'polar':
if g_axes.ndim == 3:
g_axes = axes()
r = g_axes.step(x, y, *args, **kwargs)
@ -238,7 +238,7 @@ def errorbar(x, y, yerr=None, xerr=None, fmt='', ecolor=None, elinewidth=None, c
if g_axes is None:
g_axes = axes()
else:
if g_axes.axestype != 'cartesian' and g_axes.axestype != 'polar':
if g_axes.ndim == 3:
g_axes = axes()
r = g_axes.errorbar(x, y, yerr, xerr, fmt, ecolor, elinewidth, capsize, **kwargs)
@ -256,7 +256,7 @@ def bar(x, height, width=0.8, bottom=None, align='center', data=None, **kwargs):
if g_axes is None:
g_axes = axes()
else:
if g_axes.axestype != 'cartesian' and g_axes.axestype != 'polar':
if g_axes.ndim == 3:
g_axes = axes()
r = g_axes.bar(x, height, width, bottom, align, data, **kwargs)
@ -288,7 +288,7 @@ def barh(*args, **kwargs):
if g_axes is None:
g_axes = axes()
else:
if g_axes.axestype != 'cartesian' and g_axes.axestype != 'polar':
if g_axes.ndim == 3:
g_axes = axes()
r = g_axes.barh(*args, **kwargs)
@ -307,7 +307,7 @@ def hist(x, bins=10, density=False, cumulative=False,
if g_axes is None:
g_axes = axes()
else:
if g_axes.axestype != 'cartesian':
if g_axes.ndim == 3:
g_axes = axes()
r = g_axes.hist(x, bins, density, cumulative,
@ -326,7 +326,7 @@ def stem(*args, **kwargs):
if g_axes is None:
g_axes = axes()
else:
if g_axes.axestype != 'cartesian':
if g_axes.ndim == 3:
g_axes = axes()
r = g_axes.stem(*args, **kwargs)
@ -358,9 +358,9 @@ def scatter(*args, **kwargs):
if g_axes is None:
g_axes = axes()
# else:
# if g_axes.axestype != 'cartesian':
# g_axes = axes()
else:
if g_axes.ndim == 3:
g_axes = axes()
r = g_axes.scatter(*args, **kwargs)
if r is not None:
@ -389,7 +389,7 @@ def arrow(x, y, dx, dy, **kwargs):
if g_axes is None:
g_axes = axes()
else:
if g_axes.axestype != 'cartesian':
if g_axes.ndim == 3:
g_axes = axes()
r = g_axes.arrow(x, y, dx, dy, **kwargs)
@ -407,7 +407,7 @@ def arrowline(x, y, dx=0, dy=0, **kwargs):
if g_axes is None:
g_axes = axes()
else:
if g_axes.axestype != 'cartesian':
if g_axes.ndim == 3:
g_axes = axes()
r = g_axes.arrowline(x, y, dx, dy, **kwargs)
@ -425,7 +425,7 @@ def annotate(s, xy, *args, **kwargs):
if g_axes is None:
g_axes = axes()
else:
if g_axes.axestype != 'cartesian':
if g_axes.ndim == 3:
g_axes = axes()
r = g_axes.annotate(s, xy, *args, **kwargs)
@ -442,6 +442,9 @@ def fill(x, y, color=None, **kwargs):
if g_axes is None:
g_axes = axes()
else:
if g_axes.ndim == 3:
g_axes = axes()
r = g_axes.fill(x, y, color, **kwargs)
if r is not None:
@ -472,9 +475,9 @@ def patch(x, y=None, **kwargs):
if g_axes is None:
g_axes = axes()
# else:
# if g_axes.axestype != 'cartesian':
# g_axes = axes()
else:
if g_axes.ndim == 3:
g_axes = axes()
r = g_axes.patch(x, y, **kwargs)
if r is not None:
@ -491,7 +494,7 @@ def rectangle(position, curvature=None, **kwargs):
if g_axes is None:
g_axes = axes()
else:
if g_axes.axestype != 'cartesian':
if g_axes.ndim == 3:
g_axes = axes()
r = g_axes.rectangle(position, curvature, **kwargs)
@ -509,7 +512,7 @@ def fill_between(x, y1, y2=0, where=None, **kwargs):
if g_axes is None:
g_axes = axes()
else:
if g_axes.axestype != 'cartesian':
if g_axes.ndim == 3:
g_axes = axes()
r = g_axes.fill_between(x, y1, y2, where, **kwargs)
@ -527,7 +530,7 @@ def fill_betweenx(y, x1, x2=0, where=None, **kwargs):
if g_axes is None:
g_axes = axes()
else:
if g_axes.axestype != 'cartesian':
if g_axes.ndim == 3:
g_axes = axes()
r = g_axes.fill_betweenx(y, x1, x2, where, **kwargs)
@ -546,7 +549,7 @@ def pie(x, explode=None, labels=None, colors=None, autopct=None, pctdistance=0.6
if g_axes is None:
g_axes = axes()
else:
if g_axes.axestype != 'cartesian':
if g_axes.ndim == 3:
g_axes = axes()
r = g_axes.pie(x, explode, labels, colors, autopct, pctdistance, shadow,
@ -567,7 +570,7 @@ def boxplot(x, sym=None, vert=True, positions=None, widths=None, color=None, sho
if g_axes is None:
g_axes = axes()
else:
if g_axes.axestype != 'cartesian':
if g_axes.ndim == 3:
g_axes = axes()
r = g_axes.boxplot(x, sym, vert, positions, widths, color, showcaps, showfliers, showmeans,
@ -588,7 +591,7 @@ def violinplot(dataset, positions=None, widths=0.5, boxwidth=0.01, boxprops=None
if g_axes is None:
g_axes = axes()
else:
if g_axes.axestype != 'cartesian':
if g_axes.ndim == 3:
g_axes = axes()
r = g_axes.violinplot(dataset, positions, widths, boxwidth, boxprops, whiskerprops, **kwargs)

View File

@ -35,7 +35,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<revision>3.8.4</revision>
<revision>3.8.5</revision>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<maven.compiler.release>8</maven.compiler.release>