From a9fb4d1555cbf93fb8dbb3bc3055ff9ff546cc95 Mon Sep 17 00:00:00 2001 From: Mehmet Hakan Satman Date: Wed, 26 Apr 2023 15:18:11 +0300 Subject: [PATCH] replace RGB{} with RGBX{} in plots --- CHANGELOG.md | 1 + src/LinRegOutliers.jl | 4 ++-- src/dataimage.jl | 8 ++++---- test/runtests.jl | 2 +- test/testdataimage.jl | 10 +++++----- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43f4392..045d2f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/LinRegOutliers.jl b/src/LinRegOutliers.jl index 039a01f..4936fec 100644 --- a/src/LinRegOutliers.jl +++ b/src/LinRegOutliers.jl @@ -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") @@ -17,7 +17,7 @@ function __init__() import .DataImage: dataimage import .BCHPlot: bchplot - export mveltsplot, dataimage, bchplot, RGB + export mveltsplot, dataimage, bchplot, RGBX end end diff --git a/src/dataimage.jl b/src/dataimage.jl index dfd638b..871250b 100644 --- a/src/dataimage.jl +++ b/src/dataimage.jl @@ -5,7 +5,7 @@ export dataimage import ..Diagnostics: mahalanobisSquaredMatrix, euclideanDistances, mahalanobisSquaredBetweenPairs -import ..RGB +import ..RGBX """ @@ -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) @@ -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 diff --git a/test/runtests.jl b/test/runtests.jl index 9469820..2503dbb 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -4,7 +4,7 @@ using Random using LinearAlgebra using LinRegOutliers -import Plots: RGB +import Plots: RGBX include("testdiagnostics.jl") include("testbasis.jl") diff --git a/test/testdataimage.jl b/test/testdataimage.jl index 16aad5b..2d45a19 100644 --- a/test/testdataimage.jl +++ b/test/testdataimage.jl @@ -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