Skip to content

Commit

Permalink
Merge pull request #142 from rafaqz/plottweaks
Browse files Browse the repository at this point in the history
minor updates and fixes for plotting
  • Loading branch information
rafaqz authored Aug 8, 2020
2 parents 22f75d1 + 7cceb6c commit 28ab613
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
34 changes: 17 additions & 17 deletions src/plotrecipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ end
elseif sertype in [:histogram, :stephist, :density, :barhist, :scatterhist, :ea_histogram]
HistogramLike(), Afwd
elseif sertype in [:hline]
:ylabel --> label(Afwd)
:yguide --> label(Afwd)
data(Afwd)
elseif sertype in [:vline, :andrews]
:xlabel --> label(Afwd)
:xguide --> label(Afwd)
data(Afwd)
elseif sertype in [:violin, :dotplot, :boxplot]
ViolinLike(), Afwd
Expand All @@ -40,64 +40,64 @@ end

@recipe function f(::SeriesLike, A::AbstractArray{T,1}) where T
dim = dims(A, 1)
:ylabel --> label(A)
:xlabel --> label(dim)
:xguide --> label(dim)
:yguide --> label(A)
unwrap(index(dim)), parent(A)
end
@recipe function f(::SeriesLike, A::AbstractArray{T,2}) where T
A = maybe_permute(A, (IndependentDim, DependentDim))
ind, dep = dims(A)
:xlabel --> label(ind)
:ylabel --> label(A)
:xguide --> label(ind)
:yguide --> label(A)
:legendtitle --> label(dep)
:labels --> permutedims(index(dep))
index(ind), data(A)
end

@recipe function f(::HistogramLike, A::AbstractArray{T,1}) where T
dim = dims(A, 1)
:xlabel --> label(A)
:xguide --> label(A)
index(dim), data(A)
end
@recipe function f(::HistogramLike, A::AbstractArray{T,2}) where T
A = maybe_permute(A, (IndependentDim, DependentDim))
ind, dep = dims(A)
:xlabel --> label(A)
:xguide --> label(A)
:legendtitle --> label(dep)
:labels --> permutedims(index(dep))
index(ind), data(A)
end

@recipe function f(::ViolinLike, A::AbstractArray{T,1}) where T
dim = dims(A, 1)
:ylabel --> label(A)
:yguide --> label(A)
data(A)
end
@recipe function f(::ViolinLike, A::AbstractArray{T,2}) where T
A = maybe_permute(A, (IndependentDim, DependentDim))
ind, dep = dims(A)
:xlabel --> label(dep)
:ylabel --> label(A)
:xguide --> label(dep)
:yguide --> label(A)
:legendtitle --> label(dep)
:labels --> permutedims(index(dep))
data(A)
end

@recipe function f(::HeatMapLike, A::AbstractArray{T,1}) where T
dim = dims(A, 1)
:xlabel --> label(dim)
:ylabel --> label(A)
:xguide --> label(dim)
:yguide --> label(A)
index(dim), data(A)
end

@recipe function f(::HeatMapLike, A::AbstractArray{T,2}) where T
A = maybe_permute(A, (YDim, XDim))
y, x = dims(A)
:xlabel --> label(x)
:ylabel --> label(y)
:zlabel --> label(A)
:xguide --> label(x)
:yguide --> label(y)
:zguide --> label(A)
:colorbar_title --> label(A)
data(A)
reverse(map(index, dims(A)))..., data(A)
end

@recipe function f(::ImageLike, A::AbstractArray{T,2}) where T
Expand Down
2 changes: 0 additions & 2 deletions test/plotrecipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ sticks(da1)
histogram(da1)
stephist(da1)
barhist(da1)
heatmap(da1)
scatterhist(da1)
histogram2d(da1)
hline(da1)
Expand Down Expand Up @@ -48,7 +47,6 @@ histogram2d(da2)
hline(da2)
vline(da2)
plot(da2; seriestype=:line)
# Don't display dims currently
heatmap(da2)
contour(da2)
wireframe(da2)
Expand Down

0 comments on commit 28ab613

Please sign in to comment.