Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
SymbolixAU committed Sep 16, 2018
1 parent a2e29c6 commit 395cca8
Show file tree
Hide file tree
Showing 33 changed files with 262 additions and 241 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: RcppViridis
Package: colourvalues
Type: Package
Title: Maps Viridis Colours to Values
Title: Maps Colours to Values
Version: 0.1.0
Date: 2018-09-12
Authors@R: c(
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ export(magma)
export(plasma)
export(viridis)
importFrom(Rcpp,sourceCpp)
useDynLib(RcppViridis, .registration = TRUE)
useDynLib(colourvalues, .registration = TRUE)
26 changes: 13 additions & 13 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,54 @@
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

rcpp_colour_num_value_string_palette_hex <- function(x, palette, na_colour, alpha, include_alpha) {
.Call(`_RcppViridis_rcpp_colour_num_value_string_palette_hex`, x, palette, na_colour, alpha, include_alpha)
.Call(`_colourvalues_rcpp_colour_num_value_string_palette_hex`, x, palette, na_colour, alpha, include_alpha)
}

rcpp_colour_num_value_rgb_palette_hex <- function(x, palette, na_colour, include_alpha) {
.Call(`_RcppViridis_rcpp_colour_num_value_rgb_palette_hex`, x, palette, na_colour, include_alpha)
.Call(`_colourvalues_rcpp_colour_num_value_rgb_palette_hex`, x, palette, na_colour, include_alpha)
}

rcpp_colour_str_value_string_palette_hex <- function(x, palette, na_colour, alpha, include_alpha) {
.Call(`_RcppViridis_rcpp_colour_str_value_string_palette_hex`, x, palette, na_colour, alpha, include_alpha)
.Call(`_colourvalues_rcpp_colour_str_value_string_palette_hex`, x, palette, na_colour, alpha, include_alpha)
}

rcpp_colour_str_value_rgb_palette_hex <- function(x, palette, na_colour, include_alpha) {
.Call(`_RcppViridis_rcpp_colour_str_value_rgb_palette_hex`, x, palette, na_colour, include_alpha)
.Call(`_colourvalues_rcpp_colour_str_value_rgb_palette_hex`, x, palette, na_colour, include_alpha)
}

rcpp_colour_num_value_string_palette_rgb <- function(x, palette, na_colour, alpha, include_alpha) {
.Call(`_RcppViridis_rcpp_colour_num_value_string_palette_rgb`, x, palette, na_colour, alpha, include_alpha)
.Call(`_colourvalues_rcpp_colour_num_value_string_palette_rgb`, x, palette, na_colour, alpha, include_alpha)
}

rcpp_colour_num_value_rgb_palette_rgb <- function(x, palette, na_colour, include_alpha) {
.Call(`_RcppViridis_rcpp_colour_num_value_rgb_palette_rgb`, x, palette, na_colour, include_alpha)
.Call(`_colourvalues_rcpp_colour_num_value_rgb_palette_rgb`, x, palette, na_colour, include_alpha)
}

rcpp_colour_str_value_string_palette_rgb <- function(x, palette, na_colour, alpha, include_alpha) {
.Call(`_RcppViridis_rcpp_colour_str_value_string_palette_rgb`, x, palette, na_colour, alpha, include_alpha)
.Call(`_colourvalues_rcpp_colour_str_value_string_palette_rgb`, x, palette, na_colour, alpha, include_alpha)
}

rcpp_colour_str_value_rgb_palette_rgb <- function(x, palette, na_colour, include_alpha) {
.Call(`_RcppViridis_rcpp_colour_str_value_rgb_palette_rgb`, x, palette, na_colour, include_alpha)
.Call(`_colourvalues_rcpp_colour_str_value_rgb_palette_rgb`, x, palette, na_colour, include_alpha)
}

rcpp_viridis <- function() {
.Call(`_RcppViridis_rcpp_viridis`)
.Call(`_colourvalues_rcpp_viridis`)
}

rcpp_inferno <- function() {
.Call(`_RcppViridis_rcpp_inferno`)
.Call(`_colourvalues_rcpp_inferno`)
}

rcpp_magma <- function() {
.Call(`_RcppViridis_rcpp_magma`)
.Call(`_colourvalues_rcpp_magma`)
}

rcpp_plasma <- function() {
.Call(`_RcppViridis_rcpp_plasma`)
.Call(`_colourvalues_rcpp_plasma`)
}

rcpp_cividis <- function() {
.Call(`_RcppViridis_rcpp_cividis`)
.Call(`_colourvalues_rcpp_cividis`)
}

3 changes: 0 additions & 3 deletions R/RcppViridis-package.R

This file was deleted.

3 changes: 3 additions & 0 deletions R/colourvalues-package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#' @useDynLib colourvalues, .registration = TRUE
#' @importFrom Rcpp sourceCpp
NULL
6 changes: 3 additions & 3 deletions R/scratch.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,19 @@
# # df$col <- mapview:::zcolColors(df$x)
# # barplot(height = df$a, col = df$col, border = NA, space = 0)
# #
# # df$col <- RcppViridis::color_values(df$x)
# # df$col <- colourvalues::color_values(df$x)
# # barplot(height = df$a, col = df$col, border = NA, space = 0)
# #
# # df <- data.frame(a = 10, x = c(1:5,NA,7,NA,9,10))
# # df$col2 = mapview:::zcolColors(df$x, na.color = "#00FF00")
# # barplot(height = df$a, col = df$col2, border = NA, space = 0)
# #
# # df$col2 <- RcppViridis::colour_values(df$x, na_colour = "")
# # df$col2 <- colourvalues::colour_values(df$x, na_colour = "")
# # barplot(height = df$a, col = df$col2, border = NA, space = 0)
# #
# #
# # mapview:::zcolColors(df$x, na.color = "#00FF00")
# # substr(RcppViridis::colour_values(df$x, na_colour = "#00FF00"), 1,7)
# # substr(colourvalues::colour_values(df$x, na_colour = "#00FF00"), 1,7)
#
#
#
Expand Down
24 changes: 12 additions & 12 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
output: github_document
---

[![Travis-CI Build Status](https://travis-ci.org/SymbolixAU/RcppViridis.svg?branch=master)](https://travis-ci.org/SymbolixAU/RcppViridis)
[![Coverage status](https://codecov.io/gh/SymbolixAU/RcppViridis/branch/master/graph/badge.svg)](https://codecov.io/github/SymbolixAU/RcppViridis?branch=master)
[![Github Stars](https://img.shields.io/github/stars/SymbolixAU/RcppViridis.svg?style=social&label=Github)](https://github.com/SymbolixAU/RcppViridis)
[![Travis-CI Build Status](https://travis-ci.org/SymbolixAU/colourvalues.svg?branch=master)](https://travis-ci.org/SymbolixAU/colourvalues)
[![Coverage status](https://codecov.io/gh/SymbolixAU/colourvalues/branch/master/graph/badge.svg)](https://codecov.io/github/SymbolixAU/colourvalues?branch=master)
[![Github Stars](https://img.shields.io/github/stars/SymbolixAU/colourvalues.svg?style=social&label=Github)](https://github.com/SymbolixAU/colourvalues)

<!-- README.md is generated from README.Rmd. Please edit that file -->

Expand All @@ -17,10 +17,10 @@ knitr::opts_chunk$set(
out.height = 200
)
library(RcppViridis)
library(colourvalues)
```

# RcppViridis
# colourvalues

---

Expand Down Expand Up @@ -57,11 +57,11 @@ But don't worry, `color_values(1:5)` works as well

### How do I install it?

Install the development version from [GitHub](https://github.com/SymbolixAU/RcppViridis) with:
Install the development version from [GitHub](https://github.com/SymbolixAU/colourvalues) with:

```r
# install.packages("devtools")
devtools::install_github("SymbolixAU/RcppViridis")
devtools::install_github("SymbolixAU/colourvalues")
```

---
Expand All @@ -77,14 +77,14 @@ For example, the `LinkingTo` section in `DESCRIPTION` will look something like
```yaml
LinkingTo:
Rcpp,
RcppViridis
colourvalues
```
And in a **c++** source file so you can `#include` a header and use the available functions

```cpp
#include "RcppViridis/colours/colours_hex.hpp"
// [[Rcpp::depends(RcppViridis)]]
#include "colourvalues/colours/colours_hex.hpp"
// [[Rcpp::depends(colourvalues)]]
```

**R**
Expand Down Expand Up @@ -205,7 +205,7 @@ n <- 1e7
df <- data.frame(x = rnorm(n = n))
m <- microbenchmark(
RcppViridis = { RcppViridis::colour_values(x = df$x) },
colourvalues = { colourvalues::colour_values(x = df$x) },
scales = { col_numeric(palette = rgb(subset(viridis.map, opt=="D")[, 1:3]), domain = range(df$x))(df$x) },
times = 25
)
Expand All @@ -228,7 +228,7 @@ x <- sample(x = letters, size = n, replace = TRUE)
df <- data.frame(x = x)
m <- microbenchmark(
RcppViridis = { x <- RcppViridis::colour_values(x = df$x) },
colourvalues = { x <- colourvalues::colour_values(x = df$x) },
scales = { y <- col_factor(palette = rgb(subset(viridis.map, opt=="D")[, 1:3]), domain = unique(df$x))(df$x) },
times = 25
)
Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

[![Travis-CI Build
Status](https://travis-ci.org/SymbolixAU/RcppViridis.svg?branch=master)](https://travis-ci.org/SymbolixAU/RcppViridis)
Status](https://travis-ci.org/SymbolixAU/colourvalues.svg?branch=master)](https://travis-ci.org/SymbolixAU/colourvalues)
[![Coverage
status](https://codecov.io/gh/SymbolixAU/RcppViridis/branch/master/graph/badge.svg)](https://codecov.io/github/SymbolixAU/RcppViridis?branch=master)
status](https://codecov.io/gh/SymbolixAU/colourvalues/branch/master/graph/badge.svg)](https://codecov.io/github/SymbolixAU/colourvalues?branch=master)
[![Github
Stars](https://img.shields.io/github/stars/SymbolixAU/RcppViridis.svg?style=social&label=Github)](https://github.com/SymbolixAU/RcppViridis)
Stars](https://img.shields.io/github/stars/SymbolixAU/colourvalues.svg?style=social&label=Github)](https://github.com/SymbolixAU/colourvalues)

<!-- README.md is generated from README.Rmd. Please edit that file -->

# RcppViridis
# colourvalues

-----

Expand Down Expand Up @@ -54,11 +54,11 @@ But don’t worry, `color_values(1:5)` works as well
### How do I install it?

Install the development version from
[GitHub](https://github.com/SymbolixAU/RcppViridis) with:
[GitHub](https://github.com/SymbolixAU/colourvalues) with:

``` r
# install.packages("devtools")
devtools::install_github("SymbolixAU/RcppViridis")
devtools::install_github("SymbolixAU/colourvalues")
```

-----
Expand All @@ -76,15 +76,15 @@ something like
``` yaml
LinkingTo:
Rcpp,
RcppViridis
colourvalues
```
And in a **c++** source file so you can `#include` a header and use the
available functions

``` cpp
#include "RcppViridis/colours/colours_hex.hpp"
// [[Rcpp::depends(RcppViridis)]]
#include "colourvalues/colours/colours_hex.hpp"
// [[Rcpp::depends(colourvalues)]]
```

**R**
Expand Down Expand Up @@ -220,23 +220,23 @@ library(scales)
library(viridisLite)
#
# Attaching package: 'viridisLite'
# The following objects are masked from 'package:RcppViridis':
# The following objects are masked from 'package:colourvalues':
#
# cividis, inferno, magma, plasma, viridis
n <- 1e7
df <- data.frame(x = rnorm(n = n))
m <- microbenchmark(
RcppViridis = { RcppViridis::colour_values(x = df$x) },
colourvalues = { colourvalues::colour_values(x = df$x) },
scales = { col_numeric(palette = rgb(subset(viridis.map, opt=="D")[, 1:3]), domain = range(df$x))(df$x) },
times = 25
)
m
# Unit: seconds
# expr min lq mean median uq max neval
# RcppViridis 1.661479 1.667042 1.685440 1.670131 1.675113 1.877817 25
# scales 2.881157 2.951867 3.002407 2.987579 3.034468 3.305677 25
# expr min lq mean median uq max neval
# colourvalues 1.670992 1.702792 1.738679 1.721243 1.774181 1.864729 25
# scales 2.903132 2.988399 3.075231 3.055178 3.137970 3.450273 25
autoplot(m)
# Coordinate system already present. Adding new coordinate system, which will replace the existing one.
Expand All @@ -257,15 +257,15 @@ x <- sample(x = letters, size = n, replace = TRUE)
df <- data.frame(x = x)
m <- microbenchmark(
RcppViridis = { x <- RcppViridis::colour_values(x = df$x) },
colourvalues = { x <- colourvalues::colour_values(x = df$x) },
scales = { y <- col_factor(palette = rgb(subset(viridis.map, opt=="D")[, 1:3]), domain = unique(df$x))(df$x) },
times = 25
)
m
# Unit: milliseconds
# expr min lq mean median uq max neval
# RcppViridis 175.5278 180.3672 185.3634 187.5670 190.1344 193.8903 25
# scales 300.2514 323.6980 340.9838 337.4562 349.3760 427.9255 25
# expr min lq mean median uq max neval
# colourvalues 174.5425 177.0637 184.4805 182.2640 185.6439 250.9113 25
# scales 306.5416 315.5053 329.2387 325.5986 333.3675 381.6676 25
autoplot(m)
# Coordinate system already present. Adding new coordinate system, which will replace the existing one.
Expand Down
21 changes: 21 additions & 0 deletions colourvalues.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

AutoAppendNewline: Yes
StripTrailingWhitespace: Yes

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace,vignette
13 changes: 0 additions & 13 deletions inst/include/RcppViridis/colours.hpp

This file was deleted.

10 changes: 0 additions & 10 deletions inst/include/RcppViridis/palettes.hpp

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#ifndef RCPP_VIRIDIS_HEADERS_ALPHA_H
#define RCPP_VIRIDIS_HEADERS_ALPHA_H
#ifndef R_COLOURVALUES_ALPHA_H
#define R_COLOURVALUES_ALPHA_H

#include <Rcpp.h>
#include "RcppViridis/scale/scale.hpp"
#include "colourvalues/scale/scale.hpp"

#define ALPHA_UNKNOWN 0
#define ALPHA_PALETTE 1 // the alpha is on the palette
#define ALPHA_VECTOR 2 // the alpha is a variable / vector
#define ALPHA_CONSTANT 3 // the alpha is a constant

namespace rcppviridis {
namespace colourvalues {
namespace alpha {

inline int make_alpha_type( int alpha_size, int x_size, int palette_cols ) {
Expand Down Expand Up @@ -37,7 +37,7 @@ namespace alpha {
} else if ( alpha_type == ALPHA_PALETTE ) {
return alpha;
} else if (alpha_type == ALPHA_VECTOR ) {
rcppviridis::scale::rescale( alpha );
colourvalues::scale::rescale( alpha );
alpha = alpha * 255;
// Rcpp::Rcout << "alpha scaled: " << alpha << std::endl;
return alpha;
Expand All @@ -48,6 +48,6 @@ namespace alpha {
}

} // namespace alpha
} // namespace rcppviridis
} // namespace colourvalues

#endif
13 changes: 13 additions & 0 deletions inst/include/colourvalues/colours.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef R_COLOURVALUES_COLOURS_H
#define R_COLOURVALUES_COLOURS_H

#include "colourvalues/scale/scale.hpp"
#include "colourvalues/utils/utils.hpp"
#include "colourvalues/palette_utils/palette_utils.hpp"
#include "colourvalues/convert_colours/convert_colours.hpp"

//[[Rcpp::depends(BH)]]
#include <boost/math/interpolators/cubic_b_spline.hpp>


#endif
Loading

0 comments on commit 395cca8

Please sign in to comment.