0

I'd like to center the location of geom_step() over the value of x instead of starting at that location as described here: https://github.com/tidyverse/ggplot2/issues/3348.

My understanding is that the option "mid" for the direction parameter has been added in https://github.com/tidyverse/ggplot2/pull/3435, but it seems it is not available in the public version of R.

In fact, I get the following error when trying to use it:

# Error in match.arg(direction, c("hv", "vh")) :  
# 'arg' should be one of “hv”, “vh”

Why is the feature not available? What could I do alternatively?

I've considered using position_nudge as described here: How to center line in ggplot2::geom_step() similar to highcharter, but my elements are not at the same distance so this wouldn't work.

Thanks a lot!

  • if you read down further in that pull request, the note from September 2019 indicates it hasnot made its way to CRAN. You can go grab the relevant code yourself here: https://github.com/tidyverse/ggplot2/blob/660aad2db2b3495ae0d8040915a40d247133ffc0/R/geom-path.r – Chase Apr 25 '20 at 21:09
  • Thanks a lot. What is the process to publish this change into CRAN (and how can I see when it will make it there)? Thanks for the link to the code, would you recommend to override the geom_step function to use it? If yes, how should I go about it? Thanks again. – user13407539 Apr 26 '20 at 20:31
  • you could reply to that post and ask / inquire the timing / status...ultimately that's a decision the maintainers of ggplot2 will need to make as pushing code to CRAN is a bit of an involved process. In the short-term, you could just save down that copy of `geom_step()` and create a function in your local environment...either name it `geom_step()` or `geom_step2()` or whatever makes sense to you. This is a bit of a hack and there are better solutions, but that'll get you moving forward in the short term. – Chase Apr 27 '20 at 19:54

0 Answers0