Skip to content

Commit

Permalink
Fixes for Julia 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasnoack committed Feb 15, 2017
1 parent d60fb34 commit 5896969
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 13 deletions.
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
julia 0.5
StatsBase
Compat 0.18
3 changes: 2 additions & 1 deletion src/UnicodePlots.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
isdefined(Base, :__precompile__) && __precompile__()
__precompile__()
module UnicodePlots

using Base.Dates
using Compat
import StatsBase: Histogram, fit

export
Expand Down
4 changes: 2 additions & 2 deletions src/canvas.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
abstract GraphicsArea
abstract Canvas <: GraphicsArea
@compat abstract type GraphicsArea end
@compat abstract type Canvas <: GraphicsArea end

origin(c::Canvas) = (origin_x(c), origin_y(c))
Base.size(c::Canvas) = (width(c), height(c))
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/asciicanvas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const ascii_signs = [0b100_000_000 0b000_100_000 0b000_000_100;
0b001_000_000 0b000_001_000 0b000_000_001]

const ascii_lookup = Dict{UInt16,Char}()
const ascii_decode = Array(Char, 512)
const ascii_decode = Vector{Char}(512)
ascii_lookup[0b101_000_000] = '"'
ascii_lookup[0b111_111_111] = '@'
ascii_lookup[0b011_110_011] = '$'
Expand Down
4 changes: 2 additions & 2 deletions src/graphics/bargraphics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ type BarplotGraphics{R<:Real} <: GraphicsArea
max_len::R
symb::AbstractString

function BarplotGraphics(
@compat function BarplotGraphics{R}(
bars::Vector{R},
width::Int,
color::Symbol,
symb)
symb) where R
width = max(width, 5)
max_freq = maximum(bars)
max_len = length(string(max_freq))
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/blockcanvas.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const block_signs = [0b1000 0b0010;
0b0100 0b0001]

const block_decode = Array(Char, 16)
const block_decode = Vector{Char}(16)
block_decode[0b0000 + 1] = ' '
block_decode[0b0001 + 1] = ''
block_decode[0b0010 + 1] = ''
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/dotcanvas.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const dot_signs = [0b10 0b01]

const dot_decode = Array(Char, 5)
const dot_decode = Array{Char}(5)
dot_decode[0b00 + 1] = ' '
dot_decode[0b01 + 1] = '.'
dot_decode[0b10 + 1] = '\''
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/lookupcanvas.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
abstract LookupCanvas <: Canvas
@compat abstract type LookupCanvas <: Canvas end

lookup_encode(::LookupCanvas) = error()
lookup_decode(::LookupCanvas) = error()
Expand Down
8 changes: 6 additions & 2 deletions src/interface/histogram.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,12 @@ See also
function histogram(v, bins::Int; symb = "", args...)
result = fit(Histogram, v; nbins = bins)
edges, counts = result.edges[1], result.weights
labels = Array(String, length(counts))
binwidth = edges.step / edges.divisor
labels = Vector{String}(length(counts))
@static if VERSION < v"0.6.0-dev.2390"
binwidth = edges.step / edges.divisor
else
binwidth = edges.step.hi
end
@inbounds for i in 1:length(counts)
val = float_round_log10(edges[i], binwidth)
labels[i] = string("(", val, ",", float_round_log10(val+binwidth, binwidth), "]")
Expand Down
2 changes: 1 addition & 1 deletion src/interface/lineplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ function lineplot{D<:TimeType, R<:Real}(
X::AbstractVector{D},
Y::AbstractVector{R};
args...)
d = convert(Vector{Float64}, X)
d = convert(Vector{Float64}, Dates.value.(X))
new_plot = lineplot(d, Y; args...)
annotate!(new_plot, :bl, string(first(X)))
annotate!(new_plot, :br, string(last(X)))
Expand Down
2 changes: 1 addition & 1 deletion src/interface/spy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function spy{T<:Canvas}(
color)
else
pos_idx = vals .> 0
neg_idx = !pos_idx
neg_idx = .!pos_idx
pos_cols = cols[pos_idx]
pos_rows = rows[pos_idx]
neg_cols = cols[neg_idx]
Expand Down

0 comments on commit 5896969

Please sign in to comment.