Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
traversc committed Sep 25, 2024
1 parent 3643b2a commit 49a16b3
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Version 0.13.0 (2024-09-024)
* Suggest 'qs2' instead of 'qs'
* Add 'light_cool_colors' theme
Version 0.12.0 (2023-04-06)
* Initial tracking
* Add 'relx' and 'rely' functions to make the point radius a proportion of the data range
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ nt <- 4

data(diamonds)
gm <- GlowMapper$new(xdim=800, ydim = 640, blend_mode = "screen", nthreads=nt)
gm$map(x=diamonds$carat, y=diamonds$price, intensity=1, radius = relx(0.02)) # relx(0.02) makes point size relative to x-axis

# relx(0.002) makes point size relative to x-axis, e.g. each point radius is 0.2% of the y-axis
gm$map(x=diamonds$carat, y=diamonds$price, intensity=1, radius = rely(0.002))
pd <- gm$output_dataframe(saturation = 1)

# Dark color theme
Expand Down
6 changes: 3 additions & 3 deletions inst/examples/examples.R
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ library(viridisLite) # Magma color scale

data(diamonds)
gm <- GlowMapper$new(xdim=800, ydim = 640, blend_mode = "screen", nthreads=nt)
gm$map(x=diamonds$carat, y=diamonds$price, intensity=1, radius = .1)
gm$map(x=diamonds$carat, y=diamonds$price, intensity=1, radius = rely(0.002))
pd <- gm$output_dataframe(saturation = 1)

# Dark color theme
Expand All @@ -268,7 +268,7 @@ trim_image(outfile, magma(12)[1])


# light color theme
light_colors <- colorRampPalette(c("red", "darkorange2", "darkgoldenrod1", "gold1", "yellow2"))(144)
light_colors <- glow::light_heat_colors(144)
g <- ggplot() +
geom_raster(data = pd, aes(x = pd$x, y = pd$y, fill = pd$value), show.legend = F) +
scale_fill_gradientn(colors = additive_alpha(light_colors)) +
Expand All @@ -281,7 +281,7 @@ ggsave(g, file=outfile, width=10, height=4, dpi=96)
trim_image(outfile, "white")

# light color theme with cool colors
light_colors <- colorRampPalette(c("#1133AA", "#CCFFFF"))(144)
light_colors <- light_cool_colors(144)
g <- ggplot() +
geom_raster(data = pd, aes(x = pd$x, y = pd$y, fill = pd$value), show.legend = F) +
scale_fill_gradientn(colors = additive_alpha(light_colors)) +
Expand Down
Binary file modified vignettes/diamonds_vignette_cool.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/diamonds_vignette_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/diamonds_vignette_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 15 additions & 13 deletions vignettes/vignette.html

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion vignettes/vignette.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ nt <- 4
data(diamonds)
gm <- GlowMapper$new(xdim=800, ydim = 640, blend_mode = "screen", nthreads=nt)
gm$map(x=diamonds$carat, y=diamonds$price, intensity=1, radius = relx(0.02)) # relx(0.02) makes point size relative to x-axis
# relx(0.002) makes point size relative to x-axis, e.g. each point radius is 0.2% of the y-axis
gm$map(x=diamonds$carat, y=diamonds$price, intensity=1, radius = rely(0.002))
pd <- gm$output_dataframe(saturation = 1)
# Dark color theme
Expand Down

0 comments on commit 49a16b3

Please sign in to comment.