@@ -20,9 +20,6 @@ Default: `spring_layout`
20
20
Locations of the nodes. Can be any units you want,
21
21
but will be normalized and centered anyway
22
22
23
- `preserveratio`
24
- True if the plot shall use the same scaling factor for x and y axes.
25
-
26
23
`NODESIZE`
27
24
Optional. Max size for the nodes. Default: `3.0/sqrt(N)`
28
25
@@ -93,7 +90,6 @@ Optional. Angular width in radians for the arrows. Default: `π/9 (20 degrees)`
93
90
"""
94
91
function gplot (g:: AbstractGraph{T} ,
95
92
locs_x_in:: Vector{R} , locs_y_in:: Vector{R} ;
96
- preserveratio = false ,
97
93
nodelabel = nothing ,
98
94
nodelabelc = colorant " black" ,
99
95
nodelabelsize = 1.0 ,
@@ -136,29 +132,15 @@ function gplot(g::AbstractGraph{T},
136
132
# Scale data
137
133
min_x, max_x = extrema (locs_x)
138
134
min_y, max_y = extrema (locs_y)
139
- if preserveratio
140
- # Uniform scale
141
- function scaler (z, min, ratio)
142
- 2 * (z - min) * ratio - 1
143
- end
144
- min_ratio = min (1 / (max_x - min_x), 1 / (max_y - min_y))
145
- map! (z -> scaler (z, min_x, min_ratio), locs_x, locs_x)
146
- map! (z -> scaler (z, min_y, min_ratio), locs_y, locs_y)
147
- else
148
- # Scale to unit square
149
- function scalerunitsquare (z, a, b)
150
- 2.0 * ((z - a) / (b - a)) - 1.0
151
- end
152
- map! (z -> scalerunitsquare (z, min_x, max_x), locs_x, locs_x)
153
- map! (z -> scalerunitsquare (z, min_y, max_y), locs_y, locs_y)
135
+
136
+ # Scale to unit square
137
+ function scalerunitsquare (z, a, b)
138
+ 2.0 * ((z - a) / (b - a)) - 1.0
154
139
end
140
+ map! (z -> scalerunitsquare (z, min_x, max_x), locs_x, locs_x)
141
+ map! (z -> scalerunitsquare (z, min_y, max_y), locs_y, locs_y)
155
142
156
143
# Calculate the size of the box
157
- min_x, max_x = extrema (locs_x)
158
- min_y, max_y = extrema (locs_y)
159
- bound = 0.2
160
- units = UnitBox (min_x - bound, min_y - bound,
161
- max_x - min_x + 2 * bound, max_y - min_y + 2 * bound)
162
144
units = UnitBox (- 1.2 , - 1.2 , 2.4 , 2.4 )
163
145
164
146
# Determine sizes
0 commit comments