Morphing Projections

morph_center(proj, half_range)

morph_identity(proj, half_range)

morph_radial(proj, half_range, p_eff)

Arguments

proj

a projection matrix

half_range

scale factor for projection

p_eff

Effective dimensionality of reference data set, see tourr::display_sage() for details.

Value

A matrix with dimensions the same as proj.

Details

These functions are designed to alter the resulting projection after basis generation with the tourr and will change how the projections are animated with limn_tour() and limn_tour_link(). For morph_center() the projection is centered and then scaled by the half range, while morph_identity() only scales by half range. morph_radial() is an implemenation of the burning sage algorithm available in tourr::display_sage().

Examples

proj <- matrix(rnorm(20), ncol = 2)
half_range <- compute_half_range(proj)
morph_center(proj, half_range)
#>              [,1]        [,2]
#>  [1,] -0.04892651 -0.43451771
#>  [2,] -0.02915757 -0.03858529
#>  [3,] -0.14311967 -0.26702241
#>  [4,] -0.21912189 -0.45454275
#>  [5,]  0.76023032  0.05175684
#>  [6,]  0.24859500  0.19001058
#>  [7,] -0.79301248  0.60920540
#>  [8,] -0.12712532  0.09763497
#>  [9,]  0.25993593  0.42904600
#> [10,]  0.09170218 -0.18298562
#> attr(,"scaled:center")
#> [1] 0.35703981 0.04173324
morph_identity(proj, half_range)
#>              [,1]        [,2]
#>  [1,]  0.12126306 -0.41462480
#>  [2,]  0.14103200 -0.01869238
#>  [3,]  0.02706990 -0.24712950
#>  [4,] -0.04893232 -0.43464983
#>  [5,]  0.93041989  0.07164975
#>  [6,]  0.41878457  0.20990350
#>  [7,] -0.62282291  0.62909831
#>  [8,]  0.04306425  0.11752788
#>  [9,]  0.43012550  0.44893891
#> [10,]  0.26189174 -0.16309270
morph_radial(proj, half_range, p_eff = 2)
#>                 x           y
#>  [1,] -0.43451771 -0.04892651
#>  [2,] -0.03858529 -0.02915757
#>  [3,] -0.26702241 -0.14311967
#>  [4,] -0.45454275 -0.21912189
#>  [5,]  0.05175684  0.76023032
#>  [6,]  0.19001058  0.24859500
#>  [7,]  0.60920540 -0.79301248
#>  [8,]  0.09763497 -0.12712532
#>  [9,]  0.42904600  0.25993593
#> [10,] -0.18298562  0.09170218