Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option suppress_default_hovertext for plot_method = "ggplot" #301

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mcsimenc
Copy link

closes #300

Copy link
Collaborator

@alanocallaghan alanocallaghan left a comment

Choose a reason for hiding this comment

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

Braces and logical comments apply to other parts of the diff too

Would suggest that this should also work with plot method set to plotly

@@ -887,6 +890,7 @@ heatmaply.heatmapr <- function(x,
point_size_name = "Point size",
label_format_fun = function(...) format(..., digits = 4),
custom_hovertext = x[["matrix"]][["custom_hovertext"]],
suppress_default_hovertext = F,
Copy link
Collaborator

Choose a reason for hiding this comment

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

False not f

col, ": ", mdf[[2]], "<br>",
val, ": ", label_format_fun(mdf[[3]])
)
if(!suppress_default_hovertext)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use the same brace style as the rest of the code

@@ -95,7 +101,13 @@ ggplot_heatmap <- function(xx,
}
}
if (!is.null(custom_hovertext)) {
mdf[["text"]] <- paste0(mdf[["text"]], "<br>", custom_hovertext)
if(!suppress_default_hovertext)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Invert this if/else

@mcsimenc
Copy link
Author

@alanocallaghan at least with v1.5, when using custom_hovertext with the plot_method = plotly method the default is not shown.

@alanocallaghan
Copy link
Collaborator

What I mean is that the behavior should be equivalent

@alanocallaghan
Copy link
Collaborator

alanocallaghan commented Dec 23, 2023

This currently fails with:

heatmaply(mtcars, suppress_default_hovertext=TRUE)
Error in ggplot_heatmap(data_mat, row_text_angle, column_text_angle, scale_fill_gradient_fun,  : 
  object 'suppress_default_hovertext' not found

If I add the arg to ggplot_heatmap, I get:

heatmaply(mtcars, suppress_default_hovertext=TRUE)
Error in `.data$text`:
! Column `text` not found in `.data`.
Run `rlang::last_trace()` to see where the error occurred.

Also hovertext is currently broken generally for plot_method="plotly" so I'd want to resolve that before merging

@mcsimenc
Copy link
Author

Thanks @alanocallaghan. I added the arg to my fork and it works for me if I install heatmaply from it. Could there be other changes after merging?

@talgalili
Copy link
Owner

talgalili commented Dec 24, 2023 via email

@talgalili
Copy link
Owner

Hi @mcsimenc
Could you please finish addressing the changes @alanocallaghan requested?
I'd be happy to merge and close this, thanks.

@mcsimenc
Copy link
Author

mcsimenc commented May 20, 2024

Hey guys, I'm so sorry about the lag. I've been so busy with work and home life and haven't returned to this. They are simple changes and I will try to get to it this weekend!

@talgalili
Copy link
Owner

talgalili commented May 20, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants