Skip to content

Commit 9e1bfb5

Browse files
author
David Lonie
committed
Merge pull request #1122 from UV-CDAT/issue_1103_marker_none_1d
Issue 1103 marker none 1d
2 parents 247c243 + 8373317 commit 9e1bfb5

File tree

3 files changed

+52
-13
lines changed

3 files changed

+52
-13
lines changed

Packages/vcs/Lib/VTKPlots.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -535,31 +535,33 @@ def plot1D(self,data1,data2,tmpl,gm):
535535
x1-=.0001
536536
x2+=.0001
537537
l._worldcoordinate = [x1,x2,y1,y2]
538-
m=self.canvas.createmarker()
539-
m.type = gm.marker
540-
m.color = gm.markercolor
541-
if gm.markersize>0:
542-
m.size = gm.markersize
543-
else:
544-
m.priority=0
545-
m._x = l.x
546-
m._y = l.y
547-
m._viewport=l.viewport
548-
m._worldcoordinate = l.worldcoordinate
538+
if gm.marker is not None:
539+
m=self.canvas.createmarker()
540+
m.type = gm.marker
541+
m.color = gm.markercolor
542+
if gm.markersize>0:
543+
m.size = gm.markersize
544+
else:
545+
m.priority=0
546+
m._x = l.x
547+
m._y = l.y
548+
m._viewport=l.viewport
549+
m._worldcoordinate = l.worldcoordinate
549550

550551
if not (Y[:].min()>max(y1,y2) or Y[:].max()<min(y1,y2) \
551552
or X[:].min()>max(x1,x2) or X[:].max()<min(x1,x2)):
552553
if l.priority>0:
553554
self.canvas.plot(l,donotstoredisplay=True)
554-
if m.priority>0:
555+
if gm.marker is not None and m.priority>0:
555556
self.canvas.plot(m,donotstoredisplay=True)
556557
ren2 = self.createRenderer()
557558
self.renWin.AddRenderer(ren2)
558559
tmpl.plot(self.canvas,data1,gm,bg=self.bg,renderer=ren2,X=X,Y=Y)
559560
if hasattr(data1,"_yname"):
560561
del(data1._yname)
561562
del(vcs.elements["line"][l.name])
562-
del(vcs.elements["marker"][m.name])
563+
if gm.marker is not None:
564+
del(vcs.elements["marker"][m.name])
563565

564566
if tmpl.legend.priority>0:
565567
legd = self.canvas.createline()

testing/vcs/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ cdat_add_test(vcs_test_vectors_missing
127127
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_vectors_missing.py
128128
"--source=${BASELINE_DIR}/test_vcs_vectors_missing.png"
129129
)
130+
cdat_add_test(vcs_test_remove_marker_none_1d
131+
"${PYTHON_EXECUTABLE}"
132+
${cdat_SOURCE_DIR}/testing/vcs/test_remove_marker_none_1d.py
133+
"${BASELINE_DIR}/test_remove_marker_none_1d.png"
134+
)
130135
cdat_add_test(vcs_test_draw_logo_on
131136
"${PYTHON_EXECUTABLE}"
132137
${cdat_SOURCE_DIR}/testing/vcs/test_draw_logo_on.py
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Test if the marker can be removed (marker=None) from a 1D plot
2+
# Works in 1.5.1, but fails in 2.1
3+
#
4+
# J-Y Peterschmitt - LSCE - 03/2015
5+
6+
import vcs,numpy,cdms2,MV2,os,sys
7+
src=sys.argv[1]
8+
pth = os.path.join(os.path.dirname(__file__),"..")
9+
sys.path.append(pth)
10+
import checkimage
11+
12+
dummy_data = numpy.arange(50, dtype=numpy.float32)
13+
14+
x = vcs.init()
15+
x.drawlogooff()
16+
x.setbgoutputdimensions(1200,1091,units="pixels")
17+
18+
gm = x.createyxvsx('test_yxvsx')
19+
20+
21+
# Remove the marker
22+
gm.marker = None
23+
24+
x.plot(gm, dummy_data,bg=1)
25+
26+
fnm = "test_remove_marker_none_1d.png"
27+
x.png(fnm)
28+
print "fnm:",fnm
29+
print "src:",src
30+
ret = checkimage.check_result_image(fnm,src,checkimage.defaultThreshold)
31+
sys.exit(ret)
32+
# The end

0 commit comments

Comments
 (0)