JuliaGraphs / GraphPlot.jl

Graph visualization for Julia.
http://JuliaGraphs.github.io/GraphPlot.jl/
Other
201 stars 62 forks source link

Fix for corner case where spread is zero #112

Closed nmoran closed 4 years ago

nmoran commented 4 years ago

When the spread of points in either dimension is zero, the logic to rescale the location of points places all the points at the same location. This PR has a simple fix for this.

Example to demonstrate the issue

using GraphPlot
using LightGraphs

# case with a single point
g = SimpleGraph(1)
gplot(g, [0.0], [0.0])

# case two or more points in a line
g = SimpleGraph(3)
gplot(g, zeros(3), Float64.(1:3))
codecov[bot] commented 4 years ago

Codecov Report

Merging #112 into master will increase coverage by 0.20%. The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #112      +/-   ##
==========================================
+ Coverage   32.02%   32.22%   +0.20%     
==========================================
  Files           9        9              
  Lines         509      512       +3     
==========================================
+ Hits          163      165       +2     
- Misses        346      347       +1     
Impacted Files Coverage Δ
src/plot.jl 61.62% <66.66%> (+0.18%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1b8c963...20343ab. Read the comment docs.

simonschoelly commented 4 years ago

Thank you! I am not sure if this is exactly the best strategy to solve this issue but as we don't have anything other at the moment, it wont hurt if we merge this for now.