mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
bugfix of imshow function
This commit is contained in:
parent
445c6879db
commit
151211d7a3
@ -685,7 +685,7 @@ public class ChartText extends Shape {
|
||||
public void draw(Graphics2D g, float x, float y) {
|
||||
Dimension dim = this.getDimension(g);
|
||||
x += this.xShift;
|
||||
y += this.yShift;
|
||||
y -= this.yShift;
|
||||
|
||||
AffineTransform tempTrans = g.getTransform();
|
||||
if (this.angle != 0) {
|
||||
|
||||
@ -1,10 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<MeteoInfo File="milconfig.xml" Type="configurefile">
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\plot_types\scatter">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\fitting"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\linalg"/>
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\chart\text">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\array"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\netcdf"/>
|
||||
@ -13,20 +9,26 @@
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\dataframe"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\scatter"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite\FY"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart\text"/>
|
||||
</Path>
|
||||
<File>
|
||||
<OpenedFiles>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\map\geoshow\geoshow_2.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\plot_cuace_3d_volume.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\scatter\scatterm_grid.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\satellite\FY\FY4A_DSD_1.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\satellite\FY\FY4A_AGRI_CIX_1.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\chart\text\text_align_axesm.py"/>
|
||||
</OpenedFiles>
|
||||
<RecentFiles>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\map\geoshow\geoshow_2.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\plot_cuace_3d_volume.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\scatter\scatterm_grid.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\satellite\FY\FY4A_DSD_1.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\satellite\FY\FY4A_AGRI_CIX_1.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\chart\text\text_align_axesm.py"/>
|
||||
</RecentFiles>
|
||||
</File>
|
||||
<Font>
|
||||
@ -34,5 +36,5 @@
|
||||
</Font>
|
||||
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
|
||||
<Figure DoubleBuffering="true"/>
|
||||
<Startup MainFormLocation="-7,-7" MainFormSize="1293,685"/>
|
||||
<Startup MainFormLocation="35,0" MainFormSize="1334,786"/>
|
||||
</MeteoInfo>
|
||||
|
||||
Binary file not shown.
@ -285,7 +285,7 @@ class Axes(object):
|
||||
else:
|
||||
return self._axes.getTitle()
|
||||
|
||||
def set_title(self, label, loc='center', fontname=None, fontsize=14, bold=True, color='black', **kwargs):
|
||||
def set_title(self, label, loc='center', **kwargs):
|
||||
"""
|
||||
Set a title of the current axes.
|
||||
|
||||
@ -298,24 +298,11 @@ class Axes(object):
|
||||
:param color: (*color*) Title string color. Default is ``black`` .
|
||||
:param linespace: (*int*) Line space of multiple line title.
|
||||
"""
|
||||
exfont = False
|
||||
if fontname is None:
|
||||
fontname = 'Arial'
|
||||
else:
|
||||
exfont = True
|
||||
|
||||
if bold:
|
||||
font = Font(fontname, Font.BOLD, fontsize)
|
||||
else:
|
||||
font = Font(fontname, Font.PLAIN, fontsize)
|
||||
c = plotutil.getcolor(color)
|
||||
title = ChartText(label, font)
|
||||
title.setXAlign(loc)
|
||||
title.setUseExternalFont(exfont)
|
||||
title.setColor(c)
|
||||
linespace = kwargs.pop('linespace', None)
|
||||
if not linespace is None:
|
||||
title.setLineSpace(linespace)
|
||||
if not kwargs.has_key('bold'):
|
||||
kwargs['bold'] = True
|
||||
if not kwargs.has_key('xalign'):
|
||||
kwargs['xalign'] = 'center'
|
||||
title = plotutil.text(0, 0, label, **kwargs)
|
||||
|
||||
if loc == 'left':
|
||||
self._axes.setLeftTitle(title)
|
||||
|
||||
Binary file not shown.
@ -712,7 +712,7 @@ class GLFigure(GLChartPanel, _FigureBase):
|
||||
"""
|
||||
return self.getChart().getTitle()
|
||||
|
||||
def set_title(self, label, fontname=None, fontsize=14, bold=True, color='black'):
|
||||
def set_title(self, label, **kwargs):
|
||||
"""
|
||||
Add a centered title to the figure.
|
||||
|
||||
@ -722,21 +722,11 @@ class GLFigure(GLChartPanel, _FigureBase):
|
||||
:param bold: (*boolean*) Is bold font or not. Default is ``True`` .
|
||||
:param color: (*color*) Title string color. Default is ``black`` .
|
||||
"""
|
||||
exfont = False
|
||||
if fontname is None:
|
||||
fontname = 'Arial'
|
||||
else:
|
||||
exfont = True
|
||||
|
||||
if bold:
|
||||
font = Font(fontname, Font.BOLD, fontsize)
|
||||
else:
|
||||
font = Font(fontname, Font.PLAIN, fontsize)
|
||||
c = plotutil.getcolor(color)
|
||||
ctitle = ChartText(label, font)
|
||||
ctitle.setXAlign('center')
|
||||
ctitle.setUseExternalFont(exfont)
|
||||
ctitle.setColor(c)
|
||||
if not kwargs.has_key('bold'):
|
||||
kwargs['bold'] = True
|
||||
if not kwargs.has_key('xalign'):
|
||||
kwargs['xalign'] = 'center'
|
||||
ctitle = plotutil.text(0, 0, label, **kwargs)
|
||||
self.getChart().setTitle(ctitle)
|
||||
return ctitle
|
||||
|
||||
|
||||
Binary file not shown.
@ -840,7 +840,7 @@ class MapAxes(Axes):
|
||||
# Create graphics
|
||||
if a.ndim == 0:
|
||||
#graphics = GraphicFactory.createPoints(x._array, y._array, ls.getLegendBreak(0))
|
||||
graphics = Point2DCollection(x._array, y._array, legend=ls.getLegendBreaks(0))
|
||||
graphics = Point2DCollection(x._array, y._array, legend=ls.getLegendBreak(0))
|
||||
else:
|
||||
#graphics = GraphicFactory.createPoints(x._array, y._array, a._array, ls)
|
||||
graphics = Point2DCollection(x._array, y._array, a._array, ls)
|
||||
@ -1008,7 +1008,7 @@ class MapAxes(Axes):
|
||||
:param x: (*array_like*) Optional. X coordinate array.
|
||||
:param y: (*array_like*) Optional. Y coordinate array.
|
||||
:param z: (*array_like*) 2-D 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
|
||||
@ -1023,7 +1023,6 @@ class MapAxes(Axes):
|
||||
|
||||
:returns: (*RasterLayer*) RasterLayer created from array data.
|
||||
"""
|
||||
cmap = plotutil.getcolormap(**kwargs)
|
||||
fill_value = kwargs.pop('fill_value', -9999.0)
|
||||
ls = kwargs.pop('symbolspec', None)
|
||||
n = len(args)
|
||||
@ -1095,6 +1094,8 @@ class MapAxes(Axes):
|
||||
if ls is None:
|
||||
vmin = kwargs.pop('vmin', arr.min())
|
||||
vmax = kwargs.pop('vmax', arr.max())
|
||||
has_colors = kwargs.has_key('colors')
|
||||
cmap = plotutil.getcolormap(**kwargs)
|
||||
if len(args) > 0:
|
||||
level_arg = args[0]
|
||||
if isinstance(level_arg, int):
|
||||
@ -1105,10 +1106,13 @@ class MapAxes(Axes):
|
||||
level_arg = level_arg.aslist()
|
||||
ls = LegendManage.createImageLegend(arr._array, level_arg, cmap)
|
||||
else:
|
||||
ls = plotutil.getlegendscheme(args, vmin, vmax, **kwargs)
|
||||
norm = kwargs.pop('norm', colors.Normalize(vmin, vmax))
|
||||
ls.setNormalize(norm._norm)
|
||||
ls.setColorMap(cmap)
|
||||
if has_colors:
|
||||
ls = LegendManage.createImageLegend(arr._array, cmap)
|
||||
else:
|
||||
ls = plotutil.getlegendscheme(args, vmin, vmax, cmap, **kwargs)
|
||||
norm = kwargs.pop('norm', colors.Normalize(vmin, vmax))
|
||||
ls.setNormalize(norm._norm)
|
||||
ls.setColorMap(cmap)
|
||||
plotutil.setlegendscheme(ls, **kwargs)
|
||||
fill_color = kwargs.pop('fill_color', None)
|
||||
if not fill_color is None:
|
||||
|
||||
Binary file not shown.
@ -1209,15 +1209,15 @@ def clc():
|
||||
|
||||
|
||||
@_copy_docstring_and_deprecators(Axes.set_title)
|
||||
def title(label, loc='center', fontname=None, fontsize=14, bold=True, color='black', **kwargs):
|
||||
r = g_axes.set_title(label, loc, fontname, fontsize, bold, color, **kwargs)
|
||||
def title(label, loc='center', **kwargs):
|
||||
r = g_axes.set_title(label, loc, **kwargs)
|
||||
draw_if_interactive()
|
||||
return r
|
||||
|
||||
|
||||
@_copy_docstring_and_deprecators(Figure.set_title)
|
||||
def suptitle(label, fontname=None, fontsize=14, bold=True, color='black'):
|
||||
r = g_figure.set_title(label, fontname, fontsize, bold, color)
|
||||
def suptitle(label, **kwargs):
|
||||
r = g_figure.set_title(label, **kwargs)
|
||||
draw_if_interactive()
|
||||
return r
|
||||
|
||||
|
||||
Binary file not shown.
@ -620,13 +620,14 @@ def getlegendbreak(geometry, **kwargs):
|
||||
return lb, isunique
|
||||
|
||||
|
||||
def getlegendscheme(args, min, max, **kwargs):
|
||||
def getlegendscheme(args, min, max, cmap=None, **kwargs):
|
||||
ls = kwargs.pop('symbolspec', None)
|
||||
if ls is None:
|
||||
extend = kwargs.pop('extend', None)
|
||||
if extend is not None:
|
||||
extend = ExtendType.valueOf(extend.upper())
|
||||
cmap = getcolormap(**kwargs)
|
||||
if cmap is None:
|
||||
cmap = getcolormap(**kwargs)
|
||||
level_arg = kwargs.pop('levels', None)
|
||||
if level_arg is None and len(args) > 0:
|
||||
level_arg = args[0]
|
||||
@ -1069,6 +1070,10 @@ def text(x, y, s, **kwargs):
|
||||
yalign = kwargs.pop('yalign', None)
|
||||
if not yalign is None:
|
||||
text.setYAlign(yalign)
|
||||
linespace = kwargs.pop('linespace', None)
|
||||
if not linespace is None:
|
||||
text.setLineSpace(linespace)
|
||||
|
||||
bbox = kwargs.pop('bbox', None)
|
||||
if not bbox is None:
|
||||
fill = bbox.pop('fill', None)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user