We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 816106d commit 39e27adCopy full SHA for 39e27ad
src/plot.jl
@@ -129,16 +129,19 @@ function gplot(g::AbstractGraph{T},
129
locs_x = Float64.(locs_x_in)
130
locs_y = Float64.(locs_y_in)
131
132
+ # Scale to unit square
133
# Scale data
134
min_x, max_x = extrema(locs_x)
135
min_y, max_y = extrema(locs_y)
-
136
- # Scale to unit square
137
- function scalerunitsquare(z, a, b)
138
- 2.0 * ((z - a) / (b - a)) - 1.0
+ function scaler(z, a, b)
+ if (a - b) == 0.0
+ return 0.5
139
+ else
140
+ return 2.0 * ((z - a) / (b - a)) - 1.0
141
+ end
142
end
- map!(z -> scalerunitsquare(z, min_x, max_x), locs_x, locs_x)
- map!(z -> scalerunitsquare(z, min_y, max_y), locs_y, locs_y)
143
+ map!(z -> scaler(z, min_x, max_x), locs_x, locs_x)
144
+ map!(z -> scaler(z, min_y, max_y), locs_y, locs_y)
145
146
# Calculate the size of the box
147
units = UnitBox(-1.2, -1.2, 2.4, 2.4)
0 commit comments