Skip to content

Commit 52e902e

Browse files
doutriaux1dnadeau4
authored andcommitted
Parallel coord (#2)
* initial set of pccord addon * labels appear * labels at correct position * x labels plotted correctly * respects template passed by plot call * begining of legend drawing * legend 99% working, but I want to expose it as a separate utility * legend works * adding a utilities file where I will put the markers/legend func * legend really working * draws slab attributes legend draw function moved to vcs itself * pep8 * flake8ed * fixed polar tests
1 parent 3f179b1 commit 52e902e

File tree

4 files changed

+407
-98
lines changed

4 files changed

+407
-98
lines changed

Lib/__init__.py

Lines changed: 5 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
import EzTemplate
55
import yxvsxfill
66
import continents
7-
import vcs
8-
7+
import parallelCoordinates
98

109
def createyxvsxfill(name=None,source='default',x=None,template=None):
1110
return yxvsxfill.Gyf(name,source=source,x=x,template=template)
@@ -21,109 +20,17 @@ def createusercontinents(name=None,source="default",x=None,template=None):
2120

2221
def createpolar(name=None, source="default", x=None, template=None):
2322
if "polar_oned" not in gms:
24-
init_polar()
23+
polar.init_polar()
2524
return polar.Gpo(name, source=source, x=x, template=template)
2625

26+
def createparallelcoordinates(name=None, source="default", x=None, template=None):
27+
return parallelCoordinates.Gpc(name, source=source, x=x, template=template)
2728

2829
def getpolar(name=None):
2930
if "polar_oned" not in gms:
30-
init_polar()
31+
polar.init_polar()
3132
if name in gms["polar_oned"]:
3233
return gms["polar_oned"][name]
3334
raise KeyError("No Polar GM exists with name '%s'" % name)
3435

3536

36-
def init_polar():
37-
# Create nice polar template
38-
try:
39-
t = vcs.createtemplate("polar_oned")
40-
t.data.x1 = .2
41-
t.data.x2 = .8
42-
t.data.y1 = .2
43-
t.data.y2 = .8
44-
45-
t.legend.x1 = .85
46-
t.legend.x2 = 1
47-
t.legend.y1 = .15
48-
t.legend.y2 = .85
49-
50-
dash = vcs.createline()
51-
dash.type = "dash"
52-
dot = vcs.createline()
53-
dot.type = "dot"
54-
t.xtic1.line = dash
55-
t.ytic1.line = dot
56-
57-
left_aligned = vcs.createtextorientation()
58-
left_aligned.halign = "left"
59-
left_aligned.valign = "half"
60-
t.legend.textorientation = left_aligned
61-
except vcs.vcsError:
62-
# Template already exists
63-
pass
64-
# Create some nice default polar GMs
65-
degree_polar = polar.Gpo("degrees", template="polar_oned")
66-
degree_polar.datawc_x1 = 0
67-
degree_polar.datawc_x2 = 360
68-
degree_polar.xticlabels1 = {
69-
i: str(i) for i in range(0, 360, 45)
70-
}
71-
72-
clock_24 = polar.Gpo("diurnal", template="polar_oned")
73-
clock_24.datawc_x1 = 0
74-
clock_24.datawc_x2 = 24
75-
clock_24.clockwise = True
76-
# 6 AM on the right
77-
clock_24.theta_offset = -6
78-
clock_24.xticlabels1 = {
79-
i: str(i) for i in range(0, 24, 3)
80-
}
81-
82-
clock_24_meridiem = polar.Gpo("diurnal_12_hour", source="diurnal", template="polar_oned")
83-
clock_24_meridiem.xticlabels1 = {
84-
0: "12 AM",
85-
3: "3 AM",
86-
6: "6 AM",
87-
9: "9 AM",
88-
12: "12 PM",
89-
15: "3 PM",
90-
18: "6 PM",
91-
21: "9 PM"
92-
}
93-
94-
clock_12 = polar.Gpo("semidiurnal", source="diurnal", template="polar_oned")
95-
clock_12.datawc_x2 = 12
96-
clock_12.xticlabels1 = {
97-
i: str(i) for i in range(3, 13, 3)
98-
}
99-
# 3 on the right
100-
clock_12.theta_offset = -3
101-
102-
annual_cycle = polar.Gpo("annual_cycle", template="polar_oned")
103-
annual_cycle.datawc_x1 = 1
104-
annual_cycle.datawc_x2 = 13
105-
annual_cycle.clockwise = True
106-
annual_cycle.xticlabels1 = {
107-
1: "Jan",
108-
2: "Feb",
109-
3: "Mar",
110-
4: "Apr",
111-
5: "May",
112-
6: "Jun",
113-
7: "Jul",
114-
8: "Aug",
115-
9: "Sep",
116-
10: "Oct",
117-
11: "Nov",
118-
12: "Dec"
119-
}
120-
# Put December on the top
121-
annual_cycle.theta_offset = -2
122-
123-
seasonal = polar.Gpo("seasonal", template="polar_oned")
124-
seasonal.datawc_x1 = 0
125-
seasonal.datawc_x2 = 4
126-
seasonal.xticlabels1 = {0: "DJF", 1: "MAM", 2: "JJA", 3: "SON"}
127-
seasonal.clockwise = True
128-
# DJF on top
129-
seasonal.theta_offset = -1

Lib/core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def __init__(self,name=None,source='default',x=None,template=None):
5353
self.color_2 = 239
5454
self.legend = None
5555
self.projection='linear'
56+
self.colormap = "default"
5657
else:
5758
if isinstance(source, (str, unicode)):
5859
gm = vcsaddons.gms[self.g_type].get(source,None)

0 commit comments

Comments
 (0)