Skip to content

Commit

Permalink
change version numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
cormullion committed Dec 10, 2019
1 parent a669f4a commit 7a6f1bb
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 16 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Changelog

## [v1.9.0] - perhaps christmas 2019?
## [v1.9.0] - December 2019

- changed compatibility versions in Project.toml

### Added

- Bezier `arrow()`s can also be defined by height now
- Bezier `arrow()`s can also be defined by height of box

### Changed

Expand Down
14 changes: 7 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Luxor"
uuid = "ae8d54c2-7ccd-5906-9d76-62fc9837b5bc"
authors = ["cormullion <[email protected]>"]
version = "1.8.0"
version = "1.9.0"

[deps]
Cairo = "159f3aea-2a34-519c-b102-8c37f9878175"
Expand All @@ -21,9 +21,9 @@ test = ["Test"]

[compat]
julia = "1"
Cairo = "0.5.6, 0.6, 0.7"
Colors = "0.9"
FileIO = "1"
ImageMagick = "0.7.3"
Juno = "0.5.3, 0.7"
QuartzImageIO = "0.6"
Cairo = "0.5, 0.6, 0.7, 0.8, 1.0"
Colors = "0.6, 0.9, 1.0"
FileIO = "^1.0"
ImageMagick = "^0.7"
Juno = "^0.7"
QuartzImageIO = "^0.6"
36 changes: 30 additions & 6 deletions src/bars.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ will fit in a box `yheight` high (even if there are negative values).
To control the drawing of the text and bars, define functions that process the
end points:
`mybarfunction(bottom::Point, top::Point, value; extremes=[a, b], barnumber=0,
`mybarfunction(bottom::Point, top::Point, value; extremes=[a, b], barnumber=1,
bartotal=0)`
`mylabelfunction(bottom::Point, top::Point, value; extremes=[a, b], barnumber=0,
`mylabelfunction(bottom::Point, top::Point, value; extremes=[a, b], barnumber=1,
bartotal=0)`
and pass them like this:
Expand All @@ -29,22 +29,46 @@ bars(v, xwidth=15, yheight=10, labelfunction=mylabelfunction)
or:
```
bars(v, labelfunction = (args...; extremes=[], barnumber=0, bartotal=0) -> setgray(rand()))
bars(v, labelfunction = (args...; extremes=[], barnumber=1, bartotal=0) -> setgray(rand()))
```
Draw some Fibonacci sequence numbers:
```
fib(n) = n > 2 ? fib(n - 1) + fib(n - 2) : 1
fibs = fib.(1:15)
@draw begin
fontsize(12)
fontface("JuliaMono")
setline(20)
translate(boxbottomleft(BoundingBox() * 0.9))
bars(fibs,
barfunction = (b, t, v; kwargs...) -> line(b, t, :stroke),
labelfunction = (b, t, v; extremes=[], barnumber=1, bartotal=1) ->
begin
text(string(fibs[barnumber]), t + (0, -20), halign=:center)
text(string(barnumber), b + (0, 20), halign=:center)
end,
xwidth=35)
end
```
To suppress the text labels, use optional keyword `labels=false`.
"""
function bars(values::Array;
yheight = 200,
xwidth = 25,

barfunction = (bottom::Point, top::Point, value;
extremes=extrema(values), barnumber=0, bartotal=0) -> begin
extremes=extrema(values), barnumber=1, bartotal=0) -> begin
setline(xwidth)
line(bottom, top, :stroke)
end,

labels::Bool=true,

labelfunction = (bottom::Point, top::Point, value;
extremes=extrema(values), barnumber=0, bartotal=0) -> begin
extremes=extrema(values), barnumber=1, bartotal=0) -> begin
t = string(round(value, digits=2))
textoffset = textextents(t)[4]
fontsize(10)
Expand All @@ -55,7 +79,7 @@ function bars(values::Array;
end
text(t, tp, halign=:center, valign=:middle)
end)

# end keyword args
x = O.x
mn, mx = extrema(values)
isapprox(mn, mx, atol=0.00001) && (mx = mn + 100) # better show something than nothing
Expand Down
2 changes: 1 addition & 1 deletion src/graphlayout.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function layout_spring(adjmatrix::Array{T,2} where T;
densityconstant = 2.0,
maxiterations = 100,
initialtemperature = 2.0,
boundingbox = BoundingBox() * 0.9)
boundingbox = BoundingBox(O - (250, 250), O + (250, 250)))

N = size(adjmatrix, 1)
if N != size(adjmatrix, 2)
Expand Down

0 comments on commit 7a6f1bb

Please sign in to comment.