Skip to content

Commit

Permalink
replace RGB{} with RGBX{} in plots
Browse files Browse the repository at this point in the history
  • Loading branch information
jbytecode committed Apr 26, 2023
1 parent 0d28c70 commit a9fb4d1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

- LMS returns betas rather than coefs
- PrecompileTools integration for faster loading of package
- Replace RGB{} to RGBX{} in plots

# v0.9.5

Expand Down
4 changes: 2 additions & 2 deletions src/LinRegOutliers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using Requires
function __init__()
@require Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" begin

import .Plots: RGB
import .Plots: RGBX

include("mveltsplot.jl")
include("dataimage.jl")
Expand All @@ -17,7 +17,7 @@ function __init__()
import .DataImage: dataimage
import .BCHPlot: bchplot

export mveltsplot, dataimage, bchplot, RGB
export mveltsplot, dataimage, bchplot, RGBX

end
end
Expand Down
8 changes: 4 additions & 4 deletions src/dataimage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export dataimage
import ..Diagnostics:
mahalanobisSquaredMatrix, euclideanDistances, mahalanobisSquaredBetweenPairs

import ..RGB
import ..RGBX

"""
Expand Down Expand Up @@ -46,7 +46,7 @@ Computational Statistics & Data Analysis 43.4 (2003): 541-552.
function dataimage(
dataMatrix::Array{Float64,2};
distance = :mahalanobis,
)::Matrix{RGB{Float64}}
)::Matrix{RGBX{Float64}}
d = nothing
if distance == :mahalanobis
d = mahalanobisSquaredBetweenPairs(dataMatrix)
Expand All @@ -59,10 +59,10 @@ function dataimage(
end
colours = 1.0 .- d / maximum(d)
n, _ = size(d)
colormatrix = Array{RGB{Float64},2}(undef, n, n)
colormatrix = Array{RGBX{Float64},2}(undef, n, n)
for i = 1:n
for j = 1:n
colormatrix[i, j] = RGB(colours[i, j])
colormatrix[i, j] = RGBX(colours[i, j])
end
end
return colormatrix
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using Random
using LinearAlgebra

using LinRegOutliers
import Plots: RGB
import Plots: RGBX

include("testdiagnostics.jl")
include("testbasis.jl")
Expand Down
10 changes: 5 additions & 5 deletions test/testdataimage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
di = dataimage(datamat, distance = :euclidean)


result = RGB{Float64}[
RGB{Float64}(1.0, 1.0, 1.0) RGB{Float64}(0.5, 0.5, 0.5) RGB{Float64}(0.0, 0.0, 0.0) RGB{Float64}(0.3914193805498154, 0.3914193805498154, 0.3914193805498154)
RGB{Float64}(0.5, 0.5, 0.5) RGB{Float64}(1.0, 1.0, 1.0) RGB{Float64}(0.5, 0.5, 0.5) RGB{Float64}(0.36901018379996964, 0.36901018379996964, 0.36901018379996964)
RGB{Float64}(0.0, 0.0, 0.0) RGB{Float64}(0.5, 0.5, 0.5) RGB{Float64}(1.0, 1.0, 1.0) RGB{Float64}(0.037749551350623745, 0.037749551350623745, 0.037749551350623745)
RGB{Float64}(0.3914193805498154, 0.3914193805498154, 0.3914193805498154) RGB{Float64}(0.36901018379996964, 0.36901018379996964, 0.36901018379996964) RGB{Float64}(0.037749551350623745, 0.037749551350623745, 0.037749551350623745) RGB{Float64}(1.0, 1.0, 1.0)
result = RGBX{Float64}[
RGBX{Float64}(1.0, 1.0, 1.0) RGBX{Float64}(0.5, 0.5, 0.5) RGBX{Float64}(0.0, 0.0, 0.0) RGBX{Float64}(0.3914193805498154, 0.3914193805498154, 0.3914193805498154)
RGBX{Float64}(0.5, 0.5, 0.5) RGBX{Float64}(1.0, 1.0, 1.0) RGBX{Float64}(0.5, 0.5, 0.5) RGBX{Float64}(0.36901018379996964, 0.36901018379996964, 0.36901018379996964)
RGBX{Float64}(0.0, 0.0, 0.0) RGBX{Float64}(0.5, 0.5, 0.5) RGBX{Float64}(1.0, 1.0, 1.0) RGBX{Float64}(0.037749551350623745, 0.037749551350623745, 0.037749551350623745)
RGBX{Float64}(0.3914193805498154, 0.3914193805498154, 0.3914193805498154) RGBX{Float64}(0.36901018379996964, 0.36901018379996964, 0.36901018379996964) RGBX{Float64}(0.037749551350623745, 0.037749551350623745, 0.037749551350623745) RGBX{Float64}(1.0, 1.0, 1.0)
]

@test di isa Matrix
Expand Down

2 comments on commit a9fb4d1

@jbytecode
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/82362

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.10.0 -m "<description of version>" a9fb4d1555cbf93fb8dbb3bc3055ff9ff546cc95
git push origin v0.10.0

Please sign in to comment.