# How to make lines with Julia using Gadfly (Facility location problem)?

**URL:** https://discourse.julialang.org/t/how-to-make-lines-with-julia-using-gadfly-facility-location-problem/30525
**Category:** Community
**Tags:** question
**Created:** [October 31, 2019, 7:59am UTC](https://discourse.julialang.org/t/how-to-make-lines-with-julia-using-gadfly-facility-location-problem/30525 "2019-10-31T07:59:34Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![raul-utec](https://avatars.discourse-cdn.com/v4/letter/r/77aa72/32.png) [@raul-utec](https://discourse.julialang.org/u/raul-utec)
#### Post date: [October 31, 2019, 7:59am UTC](https://discourse.julialang.org/t/how-to-make-lines-with-julia-using-gadfly-facility-location-problem/30525/1 "2019-10-31T07:59:34Z")

</div>

Im trying to make the facility location problem algorithm where i have to connect a supplying point to a supplied point , so i got hundreds of supplied points binded to many supplying points so i got something like [this](https://www.google.com/url?sa=i&source=images&cd=&ved=2ahUKEwiFr_Gk6sXlAhWyxFkKHbfdBg8QjRx6BAgBEAQ&url=https%3A%2F%2Fwww.researchgate.net%2Ffigure%2FFacility-location-problem-example_fig1_221182599&psig=AOvVaw0ap5dpb3EbPMzLkycU7JPE&ust=1572588356325290)  
,So i got a possible solution , but dont know how to graph more than one supply point grid im trying to use the next code as example:

```julia
using Gadfly
xc = [0,1,0,-1,0,4,0,-2,0,-2]
yc = [0,3,0,-2,0,1,0,2,0,-2]
Gadfly.plot(x=xc, y=yc, Geom.path, Geom.point)

```

Im also using this code ,with vectors as geometry, but can not graph more than a single supply point and its supplied points which is binded:

```julia
using Gadfly

# coordinate system and scales are necessary for Geom.vector

coord = Coord.cartesian(xmin=-5, xmax=5, ymin=-5, ymax=5)
xsc = Scale.x_continuous(minvalue=-5, maxvalue=5)
ysc = Scale.y_continuous(minvalue=-5, maxvalue=5)

# prepare the points you want to show

xend = [1,-1,4,-2,-2]
yend = [3,-2,1,2,-2]

# create the supplying center (1,2)

x = fill(1,length(xend))
y = fill(2,length(yend))

# plot everything

Gadfly.plot(x=x,y=y,xend=xend,yend=yend,xsc,ysc,Geom.vector,coord)

```

So in attempt to graph more than one supply point i get a error, I could make using layers , but dont think proper to make it for hundreds of layers by each supply point.Regards

---

<div class="post-metadata">

### Author: ![Mattriks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattriks/32/351_2.png) [@Mattriks](https://discourse.julialang.org/u/Mattriks)
#### Post date: [October 31, 2019, 9:12am UTC](https://discourse.julialang.org/t/how-to-make-lines-with-julia-using-gadfly-facility-location-problem/30525/2 "2019-10-31T09:12:36Z")

</div>

Welcome to the Julia community!  
It think `Geom.segment` is what you’re looking for, see [example here](http://gadflyjl.org/dev/gallery/geometries/#%5BGeom.segment%5D(@ref)-1).
