Added Project.toml (in place of REQUIRE. Minor bugfix.

This commit is contained in:
Giorgio Calderone 2019-09-21 19:13:01 +02:00
parent 60541f4eda
commit 05048093db
3 changed files with 81 additions and 10 deletions

13
Project.toml Normal file
View File

@ -0,0 +1,13 @@
name = "Gnuplot"
uuid = "dc211083-a33a-5b79-959f-2ff34033469d"
[deps]
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
ReusePatterns = "a39b5e78-89b5-562b-97d8-70689129df0c"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
StructC14N = "d2514e9c-36c4-5b8e-97e2-51e7675c221c"
[compat]
julia = "≥ 1.0.0"

View File

@ -1,6 +0,0 @@
julia 1.0
StructC14N
ColorTypes
StatsBase
ReusePatterns
DataFrames

View File

@ -511,6 +511,9 @@ function iterate(gp::DrySession, state)
if ii <= length(gp.plots[mid].cmds) if ii <= length(gp.plots[mid].cmds)
return (gp.plots[mid].cmds[ii], (false, mid, ii+1)) return (gp.plots[mid].cmds[ii], (false, mid, ii+1))
end end
if length(gp.plots[mid].elems) == 0
return ("", (false, mid+1, 1))
end
s = (gp.plots[mid].flag3d ? "splot " : "plot ") * " \\\n " * s = (gp.plots[mid].flag3d ? "splot " : "plot ") * " \\\n " *
join(gp.plots[mid].elems, ", \\\n ") join(gp.plots[mid].elems, ", \\\n ")
return (s, (false, mid+1, 1)) return (s, (false, mid+1, 1))
@ -573,9 +576,19 @@ function driver(args...; flag3d=false)
function dataCompleted() function dataCompleted()
if length(data) > 0 if length(data) > 0
AllArraysAreNotEmpty = true
for i in 1:length(data)
if (typeof(data[i]) <: AbstractArray) && (length(data[i]) == 0)
@warn "Input array is empty"
AllArraysAreNotEmpty = false
break
end
end
if AllArraysAreNotEmpty
last = newdatasource(gp, data...; name=dataname) last = newdatasource(gp, data...; name=dataname)
(dataplot != nothing) && (newplotelem(gp, last, dataplot)) (dataplot != nothing) && (newplotelem(gp, last, dataplot))
end end
end
data = Vector{Any}() data = Vector{Any}()
dataname = "" dataname = ""
dataplot = nothing dataplot = nothing
@ -1208,13 +1221,64 @@ function contourlines(args...; cntrparam="level auto 10")
if nrow(out) > 0 if nrow(out) > 0
levels = unique(out.level) levels = unique(out.level)
sort!(levels) sort!(levels)
out[:levelcount] = 0 out[!, :levelcount] .= 0
for i in 1:length(levels) for i in 1:length(levels)
j = findall(out.level .== levels[i]) j = findall(out.level .== levels[i])
out[j, :levelcount] = i out[j, :levelcount] .= i
end end
end end
return out return out
end end
function boxxyerror(x, y; xmin=NaN, ymin=NaN, xmax=NaN, ymax=NaN, cartesian=false)
@assert length(x) == length(y)
@assert issorted(x)
@assert issorted(y)
xlow = Vector{Float64}(undef, length(x))
xhigh = Vector{Float64}(undef, length(x))
ylow = Vector{Float64}(undef, length(x))
yhigh = Vector{Float64}(undef, length(x))
for i in 2:length(x)-1
xlow[i] = (x[i-1] + x[i]) / 2
ylow[i] = (y[i-1] + y[i]) / 2
xhigh[i] = (x[i+1] + x[i]) / 2
yhigh[i] = (y[i+1] + y[i]) / 2
end
xlow[1] = (isfinite(xmin) ? xmin : (x[1] - (x[2]-x[1])/2))
ylow[1] = (isfinite(ymin) ? ymin : (y[1] - (y[2]-y[1])/2))
xlow[end] = (x[end] - (x[end]-x[end-1])/2)
ylow[end] = (y[end] - (y[end]-y[end-1])/2)
xhigh[1] = (x[1] + (x[2]-x[1])/2)
yhigh[1] = (y[1] + (y[2]-y[1])/2)
xhigh[end] = (isfinite(xmax) ? xmax : (x[end] + (x[end]-x[end-1])/2))
yhigh[end] = (isfinite(ymax) ? ymax : (y[end] + (y[end]-y[end-1])/2))
if !cartesian
return (x, y, xlow, xhigh, ylow, yhigh)
end
n = length(x)
i = repeat(1:n, outer=n)
j = repeat(1:n, inner=n)
return (x[i], y[j], xlow[i], xhigh[i], ylow[j], yhigh[j])
end
function histo2segments(in_x, counts)
@assert length(in_x) == length(counts)
x = Vector{Float64}()
y = Vector{Float64}()
push!(x, in_x[1])
push!(y, counts[1])
for i in 2:length(in_x)
xx = (in_x[i-1] + in_x[i]) / 2.
push!(x, xx)
push!(y, counts[i-1])
push!(x, xx)
push!(y, counts[i])
end
push!(x, in_x[end])
push!(y, counts[end])
return (x, y)
end
end #module end #module