@@ -122,61 +122,71 @@ SCATTER\\_GPLOT!(X; ...) adds a plot to `current` one.
122122"""
123123function scatter_gplot (X; marker = nothing , ms = 4 , plotOrder = :normal , c = :viridis )
124124 N, dim = size (X)
125- if marker != nothing && plotOrder != :normal
125+ if marker != nothing
126126 if size (marker) == (N,) || size (marker) == (N, 1 )
127127 marker = marker[:] # reshape N x 1 matrix to a vector of length N
128128 else
129129 error (" marker only accepts a vector of length N or an N x 1 matrix,
130130 where N is the total number of points." )
131131 end
132+ idx = 1 : N
132133 if plotOrder == :s2l
133134 idx = sortperm (marker)
134135 elseif plotOrder == :l2s
135- idx = sortperm (marker, rev= true )
136+ idx = sortperm (marker, rev = true )
136137 else
137138 error (" plotOrder only supports for :normal, :s2l, or :l2s." )
138139 end
139- X = X[idx,:]
140+ X = X[idx, :]
140141 marker = marker[idx]
141142 if length (ms) > 1
142143 ms = ms[idx]
143144 end
144145 end
145146 if dim == 2
146- scatter (X[:,1 ],X[:,2 ], marker_z = marker, ms = ms, c = c, legend = false , mswidth = 0 , cbar = true , aspect_ratio = 1 , grid = false )
147+ scatter (X[:, 1 ], X[:, 2 ], marker_z = marker, ms = ms, c = c,
148+ legend = false , mswidth = 0 , cbar = true , aspect_ratio = 1 ,
149+ grid = false )
147150 elseif dim == 3
148- scatter (X[:,1 ],X[:,2 ],X[:,3 ], marker_z = marker, ms = ms, c = c, legend = false , mswidth = 0 , cbar = true , aspect_ratio = 1 , grid = false )
151+ scatter (X[:, 1 ], X[:, 2 ], X[:, 3 ], marker_z = marker, ms = ms, c = c,
152+ legend = false , mswidth = 0 , cbar = true , aspect_ratio = 1 ,
153+ grid = false )
149154 else
150155 error (" Dimension Error: scatter_gplot only supports for 2-dim or 3-dim scatter plots." )
151156 end
152157end
153158
154159function scatter_gplot! (X; marker = nothing , ms = 4 , plotOrder = :normal , c = :viridis )
155160 N, dim = size (X)
156- if marker != nothing && plotOrder != :normal
161+ if marker != nothing
157162 if size (marker) == (N,) || size (marker) == (N, 1 )
158163 marker = marker[:] # reshape N x 1 matrix to a vector of length N
159164 else
160165 error (" marker only accepts a vector of length N or an N x 1 matrix,
161166 where N is the total number of points." )
162167 end
168+ idx = 1 : N
163169 if plotOrder == :s2l
164170 idx = sortperm (marker)
165171 elseif plotOrder == :l2s
166- idx = sortperm (marker, rev= true )
172+ idx = sortperm (marker, rev = true )
167173 else
168174 error (" plotOrder only supports for :normal, :s2l, or :l2s." )
169175 end
170- X = X[idx,:]
176+ X = X[idx, :]
171177 marker = marker[idx]
172178 if length (ms) > 1
173179 ms = ms[idx]
174180 end
175181 end
176182 if dim == 2
177- scatter! (X[:,1 ],X[:,2 ], marker_z = marker, ms = ms, c = c, legend = false , mswidth = 0 , cbar = true , aspect_ratio = 1 , grid = false )
183+ scatter! (X[:, 1 ], X[:, 2 ], marker_z = marker, ms = ms, c = c,
184+ legend = false , mswidth = 0 , cbar = true , aspect_ratio = 1 ,
185+ grid = false )
178186 elseif dim == 3
179- scatter! (X[:,1 ],X[:,2 ],X[:,3 ], marker_z = marker, ms = ms, c = c, legend = false , mswidth = 0 , cbar = true , aspect_ratio = 1 , grid = false )
187+ scatter! (X[:, 1 ], X[:, 2 ], X[:, 3 ], marker_z = marker, ms = ms, c = c,
188+ legend = false , mswidth = 0 , cbar = true , aspect_ratio = 1 ,
189+ grid = false )
180190 else
181191 error (" Dimension Error: scatter_gplot! only supports for 2-dim or 3-dim scatter plots." )
182192 end
0 commit comments