mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2026-02-01 17:20:51 +00:00
update pie function for nested pie plot
This commit is contained in:
parent
07a37040c0
commit
deefa5128d
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<MeteoInfo File="milconfig.xml" Type="configurefile">
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\dataconvert">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\linalg"/>
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\plot_types">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\interpolate"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io"/>
|
||||
@ -16,6 +15,7 @@
|
||||
<RecentFolder Folder="D:\KeyData\BC_New\script"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\data_process"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\dataconvert"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
|
||||
</Path>
|
||||
<File>
|
||||
<OpenedFiles>
|
||||
@ -23,14 +23,16 @@
|
||||
<OpenedFile File="D:\KeyData\BC_New\script\plot_bc_ave_map.py"/>
|
||||
<OpenedFile File="D:\KeyData\BC_New\script\plot_month_ave.py"/>
|
||||
<OpenedFile File="D:\KeyData\BC_New\script\plot_bc_year_ave.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\dataconvert\grib2nc-3.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\pie_nested.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\pie_nested_1.py"/>
|
||||
</OpenedFiles>
|
||||
<RecentFiles>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\io\bufr_1.py"/>
|
||||
<RecentFile File="D:\KeyData\BC_New\script\plot_bc_ave_map.py"/>
|
||||
<RecentFile File="D:\KeyData\BC_New\script\plot_month_ave.py"/>
|
||||
<RecentFile File="D:\KeyData\BC_New\script\plot_bc_year_ave.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\dataconvert\grib2nc-3.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\pie_nested.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\pie_nested_1.py"/>
|
||||
</RecentFiles>
|
||||
</File>
|
||||
<Font>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -18,6 +18,7 @@ from ucar.ma2 import Array
|
||||
from dimarray import PyGridData, DimArray, PyStationData
|
||||
from multiarray import NDArray
|
||||
from mitable import PyTableData
|
||||
import mipylib.miutil as miutil
|
||||
|
||||
from java.lang import Math, Double, Float
|
||||
from java.util import Calendar
|
||||
@ -77,6 +78,9 @@ def array(object):
|
||||
"""
|
||||
if isinstance(object, NDArray):
|
||||
return object
|
||||
if isinstance(object, (list, tuple)):
|
||||
if isinstance(object[0], datetime.datetime):
|
||||
object = miutil.dates2nums(object)
|
||||
return NDArray(ArrayUtil.array(object))
|
||||
|
||||
def dim_array(a, dims=None):
|
||||
|
||||
Binary file not shown.
BIN
MeteoInfoLab/pylib/mipylib/numeric/multiarray$py.class
Normal file
BIN
MeteoInfoLab/pylib/mipylib/numeric/multiarray$py.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -19,6 +19,7 @@ from org.meteoinfo.layer import MapLayer
|
||||
|
||||
from java.awt import Font, Color, BasicStroke
|
||||
from java.awt.image import BufferedImage
|
||||
from java.util import HashMap
|
||||
|
||||
import numbers
|
||||
import datetime
|
||||
@ -1458,6 +1459,8 @@ class Axes(object):
|
||||
autowidth = False
|
||||
x = minum.asarray(x)
|
||||
height = minum.asarray(height)
|
||||
if len(x) > 1 and isinstance(width, numbers.Number) and width <= 1:
|
||||
width = (x[1] - x[0]) * width
|
||||
width = minum.asarray(width)
|
||||
if align == 'center':
|
||||
x = x - width / 2
|
||||
@ -2423,7 +2426,7 @@ class Axes(object):
|
||||
return pb
|
||||
|
||||
def pie(self, x, explode=None, labels=None, colors=None, autopct=None, pctdistance=0.6, shadow=False,
|
||||
labeldistance=1.1, startangle=0, radius=None, hold=None, **kwargs):
|
||||
labeldistance=1.1, startangle=0, radius=None, wedgeprops=None, **kwargs):
|
||||
"""
|
||||
Plot a pie chart.
|
||||
|
||||
@ -2446,7 +2449,8 @@ class Axes(object):
|
||||
:param shadow: (*boolean*) Draw a shadow beneath the pie.
|
||||
:param startangle: (*float*) If not *0*, rotates the start of the pie chart by *angle* degrees
|
||||
counterclockwise from the x-axis.
|
||||
:radius: (*float*) The radius of the pie, if *radius* is *None* it will be set to 1.
|
||||
:param radius: (*float*) The radius of the pie, if *radius* is *None* it will be set to 1.
|
||||
:param wedgeprops: (*dict*) Dict of arguments passed to the wedge objects making the pie.
|
||||
:param fontname: (*string*) Font name. Default is ``Arial`` .
|
||||
:param fontsize: (*int*) Font size. Default is ``14`` .
|
||||
|
||||
@ -2455,7 +2459,8 @@ class Axes(object):
|
||||
n = len(x)
|
||||
x = plotutil.getplotdata(x)
|
||||
if colors is None:
|
||||
colors = plotutil.makecolors(n)
|
||||
cmap = kwargs.pop('cmap', 'matlab_jet')
|
||||
colors = plotutil.makecolors(n, cmap=cmap)
|
||||
else:
|
||||
colors = plotutil.getcolors(colors)
|
||||
|
||||
@ -2468,10 +2473,27 @@ class Axes(object):
|
||||
else:
|
||||
font = Font(fontname, Font.PLAIN, fontsize)
|
||||
fontcolor = plotutil.getcolor(fontcolor)
|
||||
if radius is None:
|
||||
radius = 1
|
||||
if wedgeprops is None:
|
||||
wedgeprops = HashMap()
|
||||
else:
|
||||
jmap = HashMap()
|
||||
for key in wedgeprops.keys():
|
||||
value = wedgeprops[key]
|
||||
if key == 'edgecolor':
|
||||
if value is None:
|
||||
jmap['drawedge'] = False
|
||||
else:
|
||||
value = plotutil.getcolor(value)
|
||||
jmap[key] = value
|
||||
else:
|
||||
jmap[key] = value
|
||||
wedgeprops = jmap
|
||||
|
||||
#Create graphics
|
||||
graphics = GraphicFactory.createPieArcs(x, colors, labels, startangle, explode, font, fontcolor, \
|
||||
labeldistance, autopct, pctdistance)
|
||||
labeldistance, autopct, pctdistance, radius, wedgeprops)
|
||||
|
||||
for graphic in graphics:
|
||||
self.add_graphic(graphic)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -852,7 +852,7 @@ def fill_betweenx(y, x1, x2=0, where=None, **kwargs):
|
||||
return r
|
||||
|
||||
def pie(x, explode=None, labels=None, colors=None, autopct=None, pctdistance=0.6, shadow=False,
|
||||
labeldistance=1.1, startangle=0, radius=None, hold=None, **kwargs):
|
||||
labeldistance=1.1, startangle=0, radius=None, wedgeprops=None, **kwargs):
|
||||
"""
|
||||
Plot a pie chart.
|
||||
|
||||
@ -875,7 +875,8 @@ def pie(x, explode=None, labels=None, colors=None, autopct=None, pctdistance=0.6
|
||||
:param shadow: (*boolean*) Draw a shadow beneath the pie.
|
||||
:param startangle: (*float*) If not *0*, rotates the start of the pie chart by *angle* degrees
|
||||
counterclockwise from the x-axis.
|
||||
:radius: (*float*) The radius of the pie, if *radius* is *None* it will be set to 1.
|
||||
:param radius: (*float*) The radius of the pie, if *radius* is *None* it will be set to 1.
|
||||
:param wedgeprops: (*dict*) Dict of arguments passed to the wedge objects making the pie.
|
||||
:param fontname: (*string*) Font name. Default is ``Arial`` .
|
||||
:param fontsize: (*int*) Font size. Default is ``14`` .
|
||||
|
||||
@ -892,7 +893,7 @@ def pie(x, explode=None, labels=None, colors=None, autopct=None, pctdistance=0.6
|
||||
gca = axes()
|
||||
|
||||
r = gca.pie(x, explode, labels, colors, autopct, pctdistance, shadow,
|
||||
labeldistance, startangle, radius, hold, **kwargs)
|
||||
labeldistance, startangle, radius, wedgeprops, **kwargs)
|
||||
if not r is None:
|
||||
draw_if_interactive()
|
||||
return r
|
||||
|
||||
Binary file not shown.
@ -450,6 +450,7 @@ def getlegendbreak(geometry, **kwargs):
|
||||
edge = kwargs.pop('edge', True)
|
||||
lb.setDrawOutline(edge)
|
||||
size = kwargs.pop('size', None)
|
||||
size = kwargs.pop('linewidth', size)
|
||||
size = kwargs.pop('edgesize', size)
|
||||
if not size is None:
|
||||
lb.setOutlineSize(size)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user