Conversation
R/layers2traces.R
Outdated
| grepl("italic", data[["fontface"]]), | ||
| paste0("<i>", text, "</i>"), | ||
| text | ||
| ) |
There was a problem hiding this comment.
I'd prefer if this was done with if() instead of ifelse()
There was a problem hiding this comment.
I was using ifelse as I was anticipating data[["fontface"]] could be a vector (I think it can be specified via aes). Is this an incorrect assumption?
There was a problem hiding this comment.
oops, yea, but in that case I prefer something like:
text[grepl("italic", data[["fontface"]])] <- paste0("<i>", text, "</i>")
| cbind(x = ifelse(xmax == Inf, layout$x_max, xmax), | ||
| y = ifelse(ymin == -Inf, layout$y_min, ymin), others)) | ||
| }) | ||
| } |
There was a problem hiding this comment.
This is a lot of redundant code...
There was a problem hiding this comment.
Good point, I've simplified things a bit.
|
|
||
| # if theme(legend.position = "none") is used, don't show a legend _or_ guide | ||
| npscales$scales <- Filter(function(x) x$guide != "none", npscales$scales) | ||
| if (npscales$n() == 0 || identical(theme$legend.position, "none")) { |
There was a problem hiding this comment.
I see this as potentially dangerous -- a scale without a guide doesn't necessarily mean it doesn't exist.
I would prefer to instead set layout.showlegend to FALSE for discrete scales and remove the colorbar for continuous ones.
There was a problem hiding this comment.
How about instead handling the discrete scale by updating this line to something like
sc$is_discrete() && sc$guide != "none"
There was a problem hiding this comment.
That won't work either for similar reasons
There was a problem hiding this comment.
I made one more attempt, hopefully we're close. Thanks.
|
Sorry for the delay @jrowen, this is looking pretty good...before I merge, would you mind writing a couple simple tests? |
|
Sorry, I too have been away from this for a while. I'll see if I can pull those together shortly. Thanks. |
|
Hi @jrowen Thanks! |
|
I added some checks for |
|
Don't worry about the build failure @jrowen. I'll have a closer look here next week |
|
Hi Carson, Thanks, |
|
I may get to this next week. #929 will take precedence. |
| textposition = paste0( | ||
| ifelse(data[["vjust"]] < 0.5, "top ", | ||
| ifelse(data[["vjust"]] > 0.5, "bottom ", "") | ||
| ), |
There was a problem hiding this comment.
Shouldn't the trailing whitespace be removed here (e.g., "top" not "top ")?
There was a problem hiding this comment.
Ahh, nevermind. I see why it's done this why
There was a problem hiding this comment.
I think this should default to "middle" (not "") though
| y = ifelse(ymax == Inf, y_max, ymax), others), | ||
| cbind(x = ifelse(xmax == Inf, x_max, xmax), | ||
| y = ifelse(ymin == -Inf, y_min, ymin), others)) | ||
| }) |
There was a problem hiding this comment.
Perhaps it's better (more efficient) to use is.finite() here?
| expect_match(info$data[[1]]$fillcolor, "rgba\\(0,0,0,0\\.0[6]+") | ||
| }) | ||
|
|
||
| p1 = ggplot(data.frame(x = 1, y = 1)) + |
There was a problem hiding this comment.
It'd be great to have another test that specifying ymin = 0.5/ymax = 1.5 gives the same result
|
Hey @cpsievert :) |
These changes were made to better support dendrograms, particularly those created with
dendextend. It adds support forfontfaceingeom_texthjustandvjustingeom_text-InfandInfingeom_rectguide = "none"Feedback is very welcome. Below is some sample code.