@@ -20,9 +20,6 @@ Default: `spring_layout`
2020Locations of the nodes. Can be any units you want,
2121but will be normalized and centered anyway
2222
23- `preserveratio`
24- True if the plot shall use the same scaling factor for x and y axes.
25-
2623`NODESIZE`
2724Optional. Max size for the nodes. Default: `3.0/sqrt(N)`
2825
@@ -93,7 +90,6 @@ Optional. Angular width in radians for the arrows. Default: `π/9 (20 degrees)`
9390"""
9491function gplot (g:: AbstractGraph{T} ,
9592 locs_x_in:: Vector{R} , locs_y_in:: Vector{R} ;
96- preserveratio = false ,
9793 nodelabel = nothing ,
9894 nodelabelc = colorant " black" ,
9995 nodelabelsize = 1.0 ,
@@ -136,29 +132,15 @@ function gplot(g::AbstractGraph{T},
136132 # Scale data
137133 min_x, max_x = extrema (locs_x)
138134 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
154139 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)
155142
156143 # 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)
162144 units = UnitBox (- 1.2 , - 1.2 , 2.4 , 2.4 )
163145
164146 # Determine sizes
0 commit comments