heatmaply icon indicating copy to clipboard operation
heatmaply copied to clipboard

grid_size seems to do nothing

Open mcsimenc opened this issue 1 year ago • 3 comments

I would like to make the smallest point smaller when using node_type = "scatter". As I understood the description in the documentation, grid_size controls this, however different values for this parameter seem to have no effect.

Large value for grid_size

# Make data
mat1 = matrix(rexp(100), nrow = 10, ncol = 10)
mat2 = matrix(c(rexp(90, rate = 1), rep(0, 10)), nrow = 10, ncol = 10)

heatmaply(
  x = mat1,
  point_size_mat = mat2,
  grid_size = 1e3,
  node_type = "scatter",
  plot_method = "ggplot"
)
image

Small value for grid_size

heatmaply(
  x = mat1,
  point_size_mat = mat2,
  grid_size = 1e-3,
  node_type = "scatter",
  plot_method = "ggplot"
)
image

Any ideas what I might be doing wrong or is going on?

mcsimenc avatar Dec 21 '23 23:12 mcsimenc

Only when using a fixed point size, and not when mapping point size to point_size_mat

alanocallaghan avatar Dec 21 '23 23:12 alanocallaghan

Got it, thank you.

My use case is in emulating a plot made with ggplot mapping point size like geom_point(mapping = aes(size = ..., but the mapping function seems like it may be different than for heatmaply.

For example, here are four plots using the same data with different point size mappings:

heatmaply(plot_method = "ggplot" ...:

image

heatmaply(plot_method = "plotly" ...:

image

ggplot + geom_point(aes(size = ...:

image

ggplot + geom_point(aes(size = ... + ggplotly

image

I would like to use plot_method = ggplot, but the difference in size mapping is greatest between ggplot + geom_point(aes(size = ... and heatmaply(plot_method = "ggplot" ....

Do you know if there are any tweaks that can be made to approach it using heatmaply?

mcsimenc avatar Dec 22 '23 01:12 mcsimenc

Truthfully no, as far as I can tell the call to ggplot2 should basically be equivalent to ggplot(data) + geom_point([...], size=size_var).

If you post reproducible code for the example plots you showed in the last comment, I'll have a look

alanocallaghan avatar Jan 02 '24 17:01 alanocallaghan