Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

Commit

Permalink
fix triv plot
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoisot committed Oct 15, 2021
1 parent c8b5715 commit 0221b55
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions docs/src/examples/multivariate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ p2 = bivariatelegend!(
# Using a trivariate mapping follows the same process, with layers representing
# the red, green, and blue channel respectively.

plot(layer1, layer2, layer3; st=:trivariate)
plot(layer1, layer2, layer3; st=:trivariate, frame=:grid)

# There are two options for this type of plots. The first is `quantiles=true`
# (which maps quantiles rather than raw values), and the second is
# `simplex=false`, which makes all values sum to 1 within a pixel. For example:

trivariate(layer1, layer2, layer3; quantiles=true, simplex=true)
trivariate(layer1, layer2, layer3; quantiles=true, simplex=true, frame=:grid)

# It is a good idea to question whether using `simplex` is appropriate. The
# legend can also be plotted using `trivariatelegend`:
Expand All @@ -110,11 +110,16 @@ trivariatelegend(layer1, layer2, layer3; quantiles=true, simplex=true)
# The legend function admits three additional arguments for the names of the
# `red`, `green`, and `blue` channels:

trivariatelegend(layer1, layer2, layer3; quantiles=true, simplex=true, red="Heterogeneity", green="Roughness", blue="Urban")
trivariatelegend(layer1, layer2, layer3; quantiles=true, simplex=true, red="Heterogeneous", green="Rough", blue="Urbanized")

# We can also combine the two elements:
# We can also combine the two elements. For reasons that are not completely
# clear, the `trivariatelegend!` method makes the whole script hang, so the best
# we can currently do is to put the legend next to the plot. This will be fixed
# in a future release.

trivariate(layer1, layer2, layer3; xlim=(-24, maximum(longitudes(layer1))))
xaxis!(p1, "Longitude")
yaxis!(p1, "Latitude")
p2 = trivariatelegend!(layer1, layer2, layer3; inset=(1, bbox(0.04, 0.05, 0.28, 0.28, :top, :left)), subplot=2, red="Heterogeneity", green="Roughness", blue="Urban")
tri1 = trivariate(layer1, layer2, layer3; xlim=(-24, maximum(longitudes(layer1))))
xaxis!(tri1, "Longitude")
yaxis!(tri1, "Latitude")
tri2 = trivariatelegend(layer1, layer2, layer3; inset=(1, bbox(0.04, 0.05, 0.28, 0.28, :top, :left)), subplot=2, red="Heterogeneity", green="Roughness", blue="Urban")

plot(tri1, tri2; layout=@layout [a{0.75w} b])

0 comments on commit 0221b55

Please sign in to comment.