mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
add makemarkers function
This commit is contained in:
parent
b2605f4f08
commit
1774654fdd
@ -52,43 +52,46 @@
|
||||
<groupId>edu.ucar</groupId>
|
||||
<artifactId>cdm-core</artifactId>
|
||||
<version>${netcdf.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>edu.ucar</groupId>
|
||||
<artifactId>bufr</artifactId>
|
||||
<version>${netcdf.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>edu.ucar</groupId>
|
||||
<artifactId>cdm-image</artifactId>
|
||||
<version>${netcdf.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>edu.ucar</groupId>
|
||||
<artifactId>cdm-misc</artifactId>
|
||||
<version>${netcdf.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>edu.ucar</groupId>
|
||||
<artifactId>cdm-radial</artifactId>
|
||||
<version>${netcdf.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>edu.ucar</groupId>
|
||||
<artifactId>grib</artifactId>
|
||||
<version>${netcdf.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>edu.ucar</groupId>
|
||||
<artifactId>netcdf4</artifactId>
|
||||
<version>${netcdf.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>edu.ucar</groupId>
|
||||
<artifactId>opendap</artifactId>
|
||||
<version>${netcdf.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>edu.ucar</groupId>
|
||||
<artifactId>cdm-mcidas</artifactId>
|
||||
<version>${netcdf.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.albfernandez</groupId>
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<MeteoInfo File="milconfig.xml" Type="configurefile">
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\gui">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\error"/>
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\traj">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\contour"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\plot"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\geotiff"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\grads"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\burf"/>
|
||||
@ -14,15 +12,21 @@
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\radar"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite\modis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\gui"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\plot"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\traj"/>
|
||||
</Path>
|
||||
<File>
|
||||
<OpenedFiles>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\plot\plot_cdata_3.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\traj\plot_traj.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\traj\plot_traj_bd.py"/>
|
||||
</OpenedFiles>
|
||||
<RecentFiles>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\plot\plot_cdata_3.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\traj\plot_traj.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\traj\plot_traj_bd.py"/>
|
||||
</RecentFiles>
|
||||
</File>
|
||||
<Font>
|
||||
|
||||
Binary file not shown.
@ -44,7 +44,7 @@ __all__ = [
|
||||
'errorbar', 'figure', 'glfigure', 'figsize', 'patch', 'rectangle', 'fill', 'fill3', 'fill_between',
|
||||
'fill_betweenx', 'fimplicit3', 'webmap', 'gca', 'gcf', 'gc_collect', 'geoshow', 'get_figure',
|
||||
'gifaddframe', 'gifanimation', 'giffinish', 'grid', 'gridshow', 'gridshowm', 'hist', 'imshow',
|
||||
'imshowm', 'isosurface', 'legend', 'left_title', 'lighting', 'loglog', 'makecolors', 'makelegend',
|
||||
'imshowm', 'isosurface', 'legend', 'left_title', 'lighting', 'loglog', 'makecolors', 'makelegend','makemarkers',
|
||||
'makesymbolspec', 'masklayer', 'material', 'mesh', 'meshc', 'model', 'particles', 'pcolor', 'pcolorm',
|
||||
'pie', 'plot', 'plot3', 'plotm', 'quiver', 'quiver3', 'quiverkey', 'quiverm', 'readlegend',
|
||||
'right_title', 'refresh', 'savefig', 'savefig_jpeg', 'scatter', 'scatter3', 'scatterm', 'semilogx',
|
||||
@ -2215,6 +2215,11 @@ def makecolors(n, cmap='matlab_jet', reverse=False, alpha=None, start=None, stop
|
||||
return plotutil.makecolors(n, cmap, reverse, alpha, start, stop)
|
||||
|
||||
|
||||
@_copy_docstring_and_deprecators(plotutil.makemarkers)
|
||||
def makemarkers(n):
|
||||
return plotutil.makemarkers(n)
|
||||
|
||||
|
||||
@_copy_docstring_and_deprecators(plotutil.makelegend)
|
||||
def makelegend(source, **kwargs):
|
||||
return plotutil.makelegend(source, **kwargs)
|
||||
|
||||
Binary file not shown.
@ -283,6 +283,8 @@ def makecolors(n, cmap='matlab_jet', reverse=False, alpha=None, start=None, stop
|
||||
def getpointstyle(style):
|
||||
if style is None:
|
||||
return None
|
||||
elif isinstance(style, PointStyle):
|
||||
return style
|
||||
|
||||
pointStyle = None
|
||||
if 'do' in style:
|
||||
@ -367,6 +369,24 @@ def gethatch(h):
|
||||
return HatchStyle.getStyle(h)
|
||||
|
||||
|
||||
def makemarkers(n):
|
||||
"""
|
||||
Make markers.
|
||||
|
||||
:param n: (*int*) The number of markers.
|
||||
|
||||
:return: (*list of markers*) The markers.
|
||||
"""
|
||||
markers = []
|
||||
i = 0
|
||||
for _ in range(n):
|
||||
if i == len(PointStyle.values()):
|
||||
i = 0
|
||||
markers.append(PointStyle.values()[i])
|
||||
i += 1
|
||||
return markers
|
||||
|
||||
|
||||
def getmarkerplotstyle(style, caption, **kwargs):
|
||||
c, style = getcolor_style(style)
|
||||
if kwargs.has_key('color'):
|
||||
@ -502,6 +522,28 @@ def getlegendbreaks(lb, **kwargs):
|
||||
if cmap is not None:
|
||||
colors = makecolors(ncolors, cmap=cmap)
|
||||
|
||||
if isinstance(lb, PolylineBreak):
|
||||
if colors is not None:
|
||||
n = len(colors)
|
||||
colors = getcolors(colors)
|
||||
markers = kwargs.pop('markers', None)
|
||||
if markers is None:
|
||||
for cc in colors:
|
||||
nlb = lb.clone()
|
||||
nlb.setColor(cc)
|
||||
nlb.setSymbolColor(cc)
|
||||
nlb.setSymbolFillColor(cc)
|
||||
lbs.append(nlb)
|
||||
else:
|
||||
for cc, marker in zip(colors, markers):
|
||||
nlb = lb.clone()
|
||||
nlb.setColor(cc)
|
||||
nlb.setDrawSymbol(True)
|
||||
nlb.setSymbolStyle(getpointstyle(marker))
|
||||
nlb.setSymbolColor(cc)
|
||||
nlb.setSymbolFillColor(cc)
|
||||
lbs.append(nlb)
|
||||
else:
|
||||
if colors is not None:
|
||||
n = len(colors)
|
||||
colors = getcolors(colors)
|
||||
|
||||
@ -1954,9 +1954,9 @@ public class FrmMain extends JFrame implements IApplication {
|
||||
double projX = pXY[0];
|
||||
double projY = pXY[1];
|
||||
if (_mapDocument.getActiveMapFrame().getMapView().getProjection().isLonLatMap()) {
|
||||
this.jLabel_Coordinate.setText("Lon: " + String.format("%1$.2f", projX) + "; Lat: " + String.format("%1$.2f", projY));
|
||||
this.jLabel_Coordinate.setText("Lon: " + String.format("%.2f", projX) + "; Lat: " + String.format("%.2f", projY));
|
||||
} else {
|
||||
this.jLabel_Coordinate.setText("X: " + String.format("%1$.1f", projX) + "; Y: " + String.format("%1$.1f", projY));
|
||||
this.jLabel_Coordinate.setText("X: " + String.format("%.1f", projX) + "; Y: " + String.format("%.1f", projY));
|
||||
String theText = this.jLabel_Coordinate.getText();
|
||||
if (_mapDocument.getActiveMapFrame().getMapView().getProjection().getProjInfo().getProjectionName() == ProjectionNames.Robinson) {
|
||||
return;
|
||||
@ -1968,8 +1968,8 @@ public class FrmMain extends JFrame implements IApplication {
|
||||
points[0] = new double[]{projX, projY};
|
||||
try {
|
||||
Reproject.reprojectPoints(points, fromProj, toProj, 0, 1);
|
||||
this.jLabel_Coordinate.setText(theText + " (Lon: " + String.format("%1$.2f", points[0][0]) + "; Lat: "
|
||||
+ String.format("%1$.2f", points[0][1]) + ")");
|
||||
this.jLabel_Coordinate.setText(theText + " (Lon: " + String.format("%.2f", points[0][0]) + "; Lat: "
|
||||
+ String.format("%.2f", points[0][1]) + ")");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user