Powerful convenience for Julia visualizations and data analysis http://juliaplots.github.io/
coloralpha(colorant"grey", 0.34)
plot
and the lines will look right.
freq => intensity
and you want to plot intensity like bars with x
at freq
?
value => frequency
1 => 17
if the number 1 occurs 17 times
[slack] <dpsanders> You can do
ks = collect(keys(frequencies))
vs = collect(values(frequencies))
p = sortperm(ks)
plot(ks[p], vs[p], m=:o)
end
but that is… pretty complicated
bar!
maybe
plot
can handle Dict
directly
plot
😉
Dict
s
plot(.... st=:scatter)
countmap
should return a special CountMap
type
[slack] <jling> ```julia> a = SortedDict(x=>rand() for x = 1:10)
SortedDict{Any,Any,Base.Order.ForwardOrdering} with 10 entries:
1 => 0.305353
2 => 0.042019
3 => 0.507064
4 => 0.677382
5 => 0.523015
6 => 0.0424785
7 => 0.942855
8 => 0.519996
9 => 0.487269
10 => 0.328405
julia> plot(a)```
SortedDict
from DataStructures.jl
ks = sort!(collect(keys(frequencies)))
plot(ks, [frequencies[k] for k in ks])
Dict
) but failed, where are the recipe now?
@which
?
hspan!() has an odd behaviour in Plots v1.6.6, instead of plotting from -Inf to +Inf over x it plots from 1 to 2. Minimum example
julia> plot(0:9)
julia> hspan!([2,3])
I am surprised to see this definition, that seems plain wrong
@recipe function f(::Type{Val{:hspan}}, x, y, z)
n = div(length(y), 2)
newx = repeat([1, 2, 2, 1, NaN], outer = n)
newy = vcat([[y[2i - 1], y[2i - 1], y[2i], y[2i], NaN] for i = 1:n]...)
linewidth --> 0
x := newx
y := newy
seriestype := :shape
()
end
I think that using Inf similarly to vspan would fix this issue
@recipe function f(::Type{Val{:vspan}}, x, y, z)
n = div(length(y), 2)
newx = vcat([[y[2i - 1], y[2i - 1], y[2i], y[2i], NaN] for i = 1:n]...)
newy = repeat([-Inf, Inf, Inf, -Inf, NaN], outer = n)
linewidth --> 0
x := newx
y := newy
seriestype := :shape
()
end
aspect_ratio=:equal
doesn't seem to work
isovalue
(= threshold)