Skip to content

Commit

Permalink
tweak packages
Browse files Browse the repository at this point in the history
  • Loading branch information
cormullion committed Oct 7, 2023
1 parent f1a467f commit b21c857
Show file tree
Hide file tree
Showing 17 changed files with 50 additions and 45 deletions.
4 changes: 4 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ authors = ["cormullion <[email protected]> and contributors"]
version = "1.0.0"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
Luxor = "ae8d54c2-7ccd-5906-9d76-62fc9837b5bc"
NetworkLayout = "46757867-2c16-5918-afeb-47bfcb05e46a"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SimpleWeightedGraphs = "47aef6b3-ad0c-573a-a1e2-d07658019622"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"

[compat]
Colors = "0.10, 0.11, 0.12"
Expand Down
16 changes: 10 additions & 6 deletions docs/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.9.2"
manifest_format = "2.0"
project_hash = "ef3c9186cf034673db73cb73bbf83b59f51ae062"
project_hash = "a32caa96d0a8a49a6dbe1ccd588c35486da0dfe3"

[[deps.ANSIColoredPrinters]]
git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c"
Expand Down Expand Up @@ -490,9 +490,9 @@ uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"

[[deps.MarkdownAST]]
deps = ["AbstractTrees", "Markdown"]
git-tree-sha1 = "e8513266815200c0c8f522d6d44ffb5e9b366ae4"
git-tree-sha1 = "465a70f0fc7d443a00dcdc3267a497397b8a3899"
uuid = "d0879d2d-cac2-40c8-9cee-1863dc0c7391"
version = "0.1.1"
version = "0.1.2"

[[deps.MbedTLS_jll]]
deps = ["Artifacts", "Libdl"]
Expand Down Expand Up @@ -525,10 +525,14 @@ uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
version = "1.0.2"

[[deps.NetworkLayout]]
deps = ["GeometryBasics", "LinearAlgebra", "Random", "Requires", "SparseArrays", "StaticArrays"]
git-tree-sha1 = "2bfd8cd7fba3e46ce48139ae93904ee848153660"
deps = ["GeometryBasics", "LinearAlgebra", "Random", "Requires", "StaticArrays"]
git-tree-sha1 = "91bb2fedff8e43793650e7a677ccda6e6e6e166b"
uuid = "46757867-2c16-5918-afeb-47bfcb05e46a"
version = "0.4.5"
version = "0.4.6"
weakdeps = ["Graphs"]

[deps.NetworkLayout.extensions]
NetworkLayoutGraphsExt = "Graphs"

[[deps.NetworkOptions]]
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
Expand Down
14 changes: 7 additions & 7 deletions docs/src/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ d = @drawsvg begin
edgestrokeweights=2,
vertexlabels = (v) -> "thing $(v)",
vertexshapes = :circle,
vertexfillcolors = [RGB(Luxor.julia_red...), RGB(Luxor.julia_purple...), RGB(Luxor.julia_green...), RGB(Luxor.julia_blue...)],
vertexfillcolors = [RGB(Karnak.Luxor.julia_red...), RGB(Karnak.Luxor.julia_purple...), RGB(Karnak.Luxor.julia_green...), RGB(Karnak.Luxor.julia_blue...)],
vertexshapesizes = 25,
vertexlabeltextcolors = colorant"white",
edgelabels=(n, s, d, f, t) -> begin
Expand Down Expand Up @@ -313,7 +313,7 @@ function. Supply one of the available symbols, such as
This code generates the figure below.

```@example smallgraphs
using Karnak, Luxor, Graphs, NetworkLayout
using Karnak, Graphs, NetworkLayout
smallgraphs = (
(:bull, "bull"),
(:chvatal, "chvatal"),
Expand Down Expand Up @@ -884,7 +884,7 @@ In the next example, we start with a *binary tree*, in which each vertex is conn
This code generates the figure below.

```@example graphsection
using Karnak, Luxor, Graphs, NetworkLayout, Colors
using Karnak, Graphs, NetworkLayout, Colors
d = @drawsvg begin
background("grey10")
Expand All @@ -905,10 +905,10 @@ d = @drawsvg begin
edgegaps=12,
vertexlabels = 1:nv(g),
vertexshapes=:circle,
vertexfillcolors=[RGB(Luxor.julia_red...),
RGB(Luxor.julia_purple...),
RGB(Luxor.julia_green...),
RGB(Luxor.julia_blue...)],
vertexfillcolors=[RGB(Karnak.Luxor.julia_red...),
RGB(Karnak.Luxor.julia_purple...),
RGB(Karnak.Luxor.julia_green...),
RGB(Karnak.Luxor.julia_blue...)],
vertexshapesizes=12,
vertexlabeltextcolors=colorant"white",
)
Expand Down
10 changes: 5 additions & 5 deletions docs/src/examples.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```@setup tubesection
using Karnak, Luxor, Graphs, NetworkLayout, Colors
using Karnak, Graphs, NetworkLayout, Colors
using DataFrames, CSV, DelimitedFiles
# positions are in LatLong
Expand All @@ -13,7 +13,7 @@ g = Graph(amatrix)
extrema_lat = extrema(tubedata.Latitude)
extrema_long = extrema(tubedata.Longitude)
# scale LatLong and flip in y to fit into current Luxor drawing
# scale LatLong and flip in y to fit into current drawing
positions = @. Point(rescale(tubedata.Longitude, extrema_long..., -280, 280), rescale(tubedata.Latitude, extrema_lat..., 280, -280))
stations = tubedata[!,:Station]
Expand Down Expand Up @@ -355,7 +355,7 @@ station names, latitude and longitudes, and connectivity
details.

```julia
using Karnak, Luxor, Graphs, NetworkLayout, Colors
using Karnak, Graphs, NetworkLayout, Colors
using DataFrames, CSV

# positions are in LatLong
Expand All @@ -367,7 +367,7 @@ amatrix = Matrix(tubedata[:, 4:270])
extrema_lat = extrema(tubedata.Latitude)
extrema_long = extrema(tubedata.Longitude)

# scale LatLong and flip in y to fit into current Luxor drawing
# scale LatLong and flip in y to fit into current drawing

positions = @. Point(
rescale(tubedata.Longitude, extrema_long..., -280, 280),
Expand Down Expand Up @@ -662,7 +662,7 @@ innerpts = ngonside(O, 150, 4, π/2, vertices=true)
pts = vcat(outerpts, innerpts)
colors = map(c -> RGB(c...),
[Luxor.julia_blue, Luxor.julia_red, Luxor.julia_green, Luxor.julia_purple])
[Karnak.Luxor.julia_blue, Karnak.Luxor.julia_red, Karnak.Luxor.julia_green, Karnak.Luxor.julia_purple])
@drawsvg begin
squircle(O, 294, 294, :clip, rt=0.2)
Expand Down
19 changes: 9 additions & 10 deletions docs/src/syntax.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```@setup graphsection
using Karnak, Luxor, Graphs, NetworkLayout, Colors, SimpleWeightedGraphs
using Karnak, Graphs, NetworkLayout, Colors, SimpleWeightedGraphs
```

# Syntax
Expand Down Expand Up @@ -257,9 +257,9 @@ The calculated positions are returned by the `drawgraph()` function.

### Initial positions for the layout algorithms

Some of the layout algorithms - the Spring and Stress ones, for example - allow you to pass _initial_ vertex positions to be used by the algorithms as starting points. The algorithm will continually adjust them to make a better result. These initial positions should be supplied as xy pairs, rather than Luxor Points (which NetworkLayout doesn't know about).
Some of the layout algorithms - the Spring and Stress ones, for example - allow you to pass _initial_ vertex positions to be used by the algorithms as starting points. The algorithm will continually adjust them to make a better result. These initial positions should be supplied as xy pairs, rather than Points (which NetworkLayout doesn't know about).

Here's an animation showing how the Stress algorithm gradually improves the layout on each iteration. The initial positions are just the "grid locations" of a Luxor Tiler.
Here's an animation showing how the Stress algorithm gradually improves the layout on each iteration. The initial positions are just the "grid locations" of a Tiler iterator.

```julia
using Karnak, Graphs, NetworkLayout, Colors
Expand Down Expand Up @@ -310,7 +310,7 @@ edgefunction = my_edgefunction(edgenumber, edgesrc, edgedest, from::Point, to::P

These allow you to place graphics at `coordinates[vertex]`, and to draw edges from `from` to `to`, using any available tools for drawing.

In the following picture, the vertex positions were passed to a function that placed clipped PNG images on the drawing (using `Luxor.readpng()` and `Luxor.placeimage()`), and the edges were drawn using sine curves. Refer to the Luxor documentation for more about putting colored things on drawings.
In the following picture, the vertex positions were passed to a function that placed clipped PNG images on the drawing (using `readpng()` and `placeimage()`), and the edges were drawn using sine curves. Refer to the Luxor.jl documentation for more about putting colored things on drawings.

![image vertices](assets/figures/karnakmap.png)

Expand Down Expand Up @@ -503,7 +503,7 @@ drawgraph(g, layout=stress,
end 600 300
```

When circles and squares don't cut it, supply a function to `vertexshapes`. The single argument is the vertex number; any graphics you draw will be centered at the vertex location, Luxor's current origin, `Point(0, 0)`.
When circles and squares don't cut it, supply a function to `vertexshapes`. The single argument is the vertex number; any graphics you draw will be centered at the vertex location, the current origin, `Point(0, 0)`.

```@example graphsection
@drawsvg begin
Expand Down Expand Up @@ -562,7 +562,7 @@ sethue("yellow")
setline(0.2)
drawgraph(g,
layout = stress,
vertexshapes = (v) -> drawball(O, 25, RGB([Luxor.julia_red,Luxor.julia_purple, Luxor.julia_green][rand(1:end)]...))
vertexshapes = (v) -> drawball(O, 25, RGB([Karnak.Luxor.julia_red,Karnak.Luxor.julia_purple, Karnak.Luxor.julia_green][rand(1:end)]...))
)
end 600 600
```
Expand Down Expand Up @@ -611,7 +611,7 @@ g = grid((15, 15))
drawgraph(g,
layout = squaregrid,
vertexshapesizes = 15,
vertexfillcolors = [RGB([Luxor.julia_red, Luxor.julia_green,
vertexfillcolors = [RGB([Karnak.Luxor.julia_red, Luxor.julia_green,
Luxor.julia_purple][rand(1:end)]...) for i in 1:nv(g)])
end 600 600
```
Expand Down Expand Up @@ -680,7 +680,6 @@ drawgraph(g, layout=stress,
push!(B, to)
end)
# Luxor takes over:
setlinejoin("bevel")
setline(0.25)
Expand Down Expand Up @@ -742,7 +741,7 @@ drawgraph(g,
end 600 300
```

For more interesting arrows for edges, Luxor's arrows are available, and you can define functions to create all kinds of graphical deatil:
For more interesting arrows for edges, you can use arrows, and you can also define functions to create all kinds of graphical deatil:

```@example graphsection
gd = DiGraph()
Expand Down Expand Up @@ -952,7 +951,7 @@ end 600 600

### `edgecurvature` and `edgecaps`

`edgecurvature` determines the curvature of the edges, and `edgegaps` sets the distance between the tip of the arrowhead and the vertex position. Units, as everywhere in Karnak and Luxor, are points/pixels (1 point is 0.3527mm).
`edgecurvature` determines the curvature of the edges, and `edgegaps` sets the distance between the tip of the arrowhead and the vertex position. Units, as everywhere in Karnak, are points/pixels (1 point is 0.3527mm).

```@example graphsection
g = grid((3, 3))
Expand Down
4 changes: 2 additions & 2 deletions examples/dfs-animation.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# using Karnak, Luxor, Graphs, NetworkLayout, Colors
# using Karnak, Graphs, NetworkLayout, Colors
# using DataFrames, CSV
#
# # positions are in LatLong
Expand All @@ -12,7 +12,7 @@
# extrema_lat = extrema(tubedata.Latitude)
# extrema_long = extrema(tubedata.Longitude)
#
# # scale LatLong and flip in y to fit into current Luxor drawing
# # scale LatLong and flip in y to fit into current drawing
# positions = @. Point(rescale(tubedata.Longitude, extrema_long..., -280, 280), rescale(tubedata.Latitude, extrema_lat..., 280, -280))
#
# stations = tubedata[!,:Station]
Expand Down
1 change: 0 additions & 1 deletion examples/digraph16.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Karnak
using Luxor
using Colors
using Graphs
using NetworkLayout
Expand Down
4 changes: 2 additions & 2 deletions examples/example1.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Luxor, Karnak, Graphs, Colors, NetworkLayout
using Karnak, Graphs, Colors, NetworkLayout

# this was the first test page

Expand Down Expand Up @@ -191,7 +191,7 @@ function test4()
background("black")
sethue("gold")
# drawgraph(wheel_graph(12), layout=(g) -> spectral(adjacency_matrix(g), dim=2), margin=0)
drawgraph(smallgraph(:icosahedral), vertexshapesizes = collect(rand(10:30, 10)), vertexshapes=:circle, vertexfillcolors = [RGB(Luxor.julia_green...), RGB(Luxor.julia_purple...), RGB(Luxor.julia_red...)],
drawgraph(smallgraph(:icosahedral), vertexshapesizes = collect(rand(10:30, 10)), vertexshapes=:circle, vertexfillcolors = [RGB(Karnak.Luxor.julia_green...), RGB(Karnak.Luxor.julia_purple...), RGB(Karnak.Luxor.julia_red...)],
edgestrokeweights = 3:-1:1, layout=stress, margin=10)
end 600 600
end
Expand Down
2 changes: 1 addition & 1 deletion examples/julia-graphs-logo-petersen-version.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ end

colors = map(
c -> RGB(c...),
[Luxor.julia_blue, Luxor.julia_red, Luxor.julia_green, Luxor.julia_purple],
[Karnak.Luxor.julia_blue, Karnak.Luxor.julia_red, Karnak.Luxor.julia_green, Karnak.Luxor.julia_purple],
)

Drawing(600, 600, "/tmp/julia-graphs.png")
Expand Down
2 changes: 1 addition & 1 deletion examples/julia-graphs-logo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ end
outerpts = ngonside(O, 450, 4, π/4, vertices=true)
innerpts = ngonside(O, 150, 4, π/2, vertices=true)
pts = vcat(outerpts, innerpts)
colors = map(c -> RGB(c...), [Luxor.julia_blue, Luxor.julia_red, Luxor.julia_green, Luxor.julia_purple])
colors = map(c -> RGB(c...), [Karnak.Luxor.julia_blue, Karnak.Luxor.julia_red, Karnak.Luxor.julia_green, Karnak.Luxor.julia_purple])

Drawing(600, 600, "/tmp/julia-graphs.svg")
origin()
Expand Down
4 changes: 2 additions & 2 deletions examples/juliaspheres.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Karnak, Luxor, Graphs, NetworkLayout, Colors
using Karnak, Graphs, NetworkLayout, Colors

function whiten(col::Color, f=0.5)
hsl = convert(HSL, col)
Expand Down Expand Up @@ -31,7 +31,7 @@ drawgraph(g,
edgelines = 0,
vertexshapes = (v) -> begin
c = rand(1:3)
col = RGB([Luxor.julia_red,Luxor.julia_purple, Luxor.julia_green][c]...)
col = RGB([Karnak.Luxor.julia_red, Karnak.Luxor.julia_purple, Karnak.Luxor.julia_green][c]...)
drawball(O, 25, col)
c == 1 && push!(A, v)
end
Expand Down
4 changes: 2 additions & 2 deletions examples/karnak-logo.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Luxor, Karnak, Graphs, Colors, NetworkLayout
using Karnak, Graphs, Colors, NetworkLayout

function drawlittlegraph(pos, w)
@layer begin
translate(pos)
drawgraph(star_graph(12),
layout = stress,
vertexfillcolors = [RGB(Luxor.julia_purple...),RGB(Luxor.julia_green...),RGB(Luxor.julia_red...)],
vertexfillcolors = [RGB(Karnak.Luxor.julia_purple...),RGB(Karnak.Luxor.julia_green...),RGB(Karnak.Luxor.julia_red...)],
vertexshapesizes = 8,
boundingbox = BoundingBox(box(O, w, w)))
end
Expand Down
2 changes: 1 addition & 1 deletion examples/karnak-social-media-preview.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Karnak, Luxor, Graphs, NetworkLayout, Colors
using Karnak, Graphs, NetworkLayout, Colors
using Random

Random.seed!(42)
Expand Down
2 changes: 1 addition & 1 deletion examples/konigsberg.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Karnak, Luxor, Graphs, Colors, NetworkLayout, Random
using Karnak, Graphs, Colors, NetworkLayout, Random

#=
The Seven Bridges of Königsberg is a historically notable
Expand Down
4 changes: 2 additions & 2 deletions examples/maketubemapgraph.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using DataFrames, CSV
using Graphs, Karnak, Luxor, Colors, NetworkLayout
using Graphs, Karnak, Colors, NetworkLayout

cd(joinpath(@__DIR__))

Expand All @@ -14,7 +14,7 @@ g = Graph(amatrix)
extrema_lat = extrema(tubedata.Latitude)
extrema_long = extrema(tubedata.Longitude)

# scale LatLong and flip in y to fit into current Luxor drawing
# scale LatLong and flip in y to fit into current drawing
positions = @. Point(rescale(tubedata.Longitude, extrema_long..., -280, 280), rescale(tubedata.Latitude, extrema_lat..., 280, -280))

stations = tubedata[!,:Station]
Expand Down
2 changes: 1 addition & 1 deletion test/ftests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ end 600 300
drawgraph(g, layout=stress,
vertexshapes = :none,
edgestrokecolors = (n, s, d, from, to) -> begin
c = Luxor.get_current_color()
c = Karnak.Luxor.get_current_color()
if isodd(n)
RGB(c.g, c.b, c.r)
else
Expand Down
1 change: 0 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Karnak
using Test
using Luxor
using Graphs
using NetworkLayout
using Colors
Expand Down

0 comments on commit b21c857

Please sign in to comment.