Skip to content

Commit 11f5eec

Browse files
author
David Lonie
committed
Merge pull request #970 from UV-CDAT/issue_969_no_marker_x_flipped
fix #969
2 parents 4893669 + c17b697 commit 11f5eec

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

Packages/vcs/Lib/vcs2vtk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,7 @@ def prepMarker(renWin,marker,cmap=None):
11201120
# Use the difference in x to scale the point, as later we'll use the
11211121
# x range to correct the aspect ratio:
11221122
dx = marker.worldcoordinate[1] - marker.worldcoordinate[0]
1123-
s *= float(dx)/500.
1123+
s *= abs(float(dx))/500.
11241124
gs.SetScale(s)
11251125
gs.Update()
11261126

testing/vcs/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,12 @@ add_test(vcs_test_taylor_2_quads
209209
${cdat_SOURCE_DIR}/testing/vcs/test_1D_with_manyDs.py
210210
"${BASELINE_DIR}/test_1D_with_manyDs.png"
211211
)
212+
add_test(vcs_test_1d_marker_not_shown_if_xaxis_flipped
213+
${CMAKE_INSTALL_PREFIX}/bin/python
214+
${cdat_SOURCE_DIR}/testing/vcs/test_1d_marker_not_shown_if_xaxis_flipped.py
215+
${BASELINE_DIR}/test_1d_marker_not_shown_if_xaxis_flipped.png
216+
)
217+
212218

213219
# These test actually plot things need sample data
214220
if (CDAT_DOWNLOAD_SAMPLE_DATA)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import vcs
2+
import numpy
3+
import MV2
4+
import cdms2
5+
import sys
6+
import os
7+
8+
src=sys.argv[1]
9+
pth = os.path.join(os.path.dirname(__file__),"..")
10+
sys.path.append(pth)
11+
import checkimage
12+
13+
x=vcs.init()
14+
x.drawlogooff()
15+
x.setbgoutputdimensions(1200,1091,units="pixels")
16+
17+
data = MV2.array([4,5,6,7,1,3,7,9,])+230.
18+
19+
p = cdms2.createAxis([2,5,100,200,500,800,850,1000])
20+
21+
data.setAxis(0,p)
22+
23+
data.id="jim"
24+
25+
gm=x.create1d()
26+
27+
gm.linewidth=0
28+
gm.datawc_x1=1000
29+
gm.datawc_x2=0
30+
31+
gm.markersize=30
32+
33+
x.plot(data,gm,bg=1)
34+
35+
fnm = "test_1d_marker_not_shown_if_xaxis_flipped.png"
36+
x.png(fnm)
37+
38+
print "fnm:",fnm
39+
print "src:",src
40+
ret = checkimage.check_result_image(fnm,src,checkimage.defaultThreshold)
41+
sys.exit(ret)

0 commit comments

Comments
 (0)