I don't know a way to do what you want (adjust orientation of lines
in the legend) without ggstance. This works without coord_flip:
ggplot(df, aes(y, x, colour = group)) + geom_pointrange(aes(xmin =
lower, xmax = upper))
Another thing I haven't managed to do without ggstance is vertical
dodging (i.e., ggstance::position_dodgev)
This is discussed here:
https://github.com/tidyverse/ggplot2/issues/1389
and here:
https://github.com/jonocarroll/ggeasy/issues/20
On 9/16/20 9:51 AM, Yuki Takahashi wrote:
> Dear all,
>
> The ggstance says that ggplot2 version 3.3.0 (and above) now has
> horizontality support (
https://github.com/lionel-/ggstance
> <
https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_lionel-2D_ggstance&d=DwQFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=zImN_5GfvN5clExGCfuTCw&m=bTMuEPUthoJRJ64EzFGe98grYEc_iT260Nrq-N6DEmI&s=YYA7DQPmjukfV95KUcrR4FZXf5NWnPX5GCb5k1KZO_s&e=>).
> What code would allow me to have a geom_pointrangeh()-equivalent graph?
>
> _MWE (borrowed from ggeasy question:
>
https://github.com/jonocarroll/ggeasy/issues/20
> <
https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_jonocarroll_ggeasy_issues_20&d=DwQFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=zImN_5GfvN5clExGCfuTCw&m=bTMuEPUthoJRJ64EzFGe98grYEc_iT260Nrq-N6DEmI&s=zbArZ01qHcyHAw3liuP9dzCjNCqgcA0fgxHpr3fX2UA&e=>):_
> library(tidyverse)
> library(ggstance)
> # create example data frame
> df <- data.frame(x = 1:100,
> group = c(rep(TRUE, 50), rep(FALSE, 50)),
> v = seq(-4, 4, length.out = 100)) %>%
> mutate(y = tanh(v),
> lower = tanh(v) - 0.2,
> upper = tanh(v) + 0.2)
>
> # the legend key's lines are vertical
> ggplot(df, aes(x, y, colour = group)) + geom_pointrange(aes(ymin =
> lower, ymax = upper)) + coord_flip()
>
> # the legend key's lines are horizontal, but this uses ggstance. How to
> obtain this graph without using ggstance?
> ggplot(df, aes(y, x, colour = group)) +
> ggstance::geom_pointrangeh(aes(xmin = lower, xmax = upper))
>
> Best,
> Yuki
>
> --
> --
> You received this message because you are subscribed to the ggplot2
> mailing list.
> Please provide a reproducible example:
>
https://github.com/hadley/devtools/wiki/Reproducibility
> <
https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_hadley_devtools_wiki_Reproducibility&d=DwMFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=zImN_5GfvN5clExGCfuTCw&m=bTMuEPUthoJRJ64EzFGe98grYEc_iT260Nrq-N6DEmI&s=BgPS_SDWRgCoDk12N-g8HkJWcFBwBDCWCZSTApO8W14&e=>
>
> To post: email
ggp...@googlegroups.com
> To unsubscribe: email
ggplot2+u...@googlegroups.com
> More options:
http://groups.google.com/group/ggplot2
> <
https://urldefense.proofpoint.com/v2/url?u=http-3A__groups.google.com_group_ggplot2&d=DwMFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=zImN_5GfvN5clExGCfuTCw&m=bTMuEPUthoJRJ64EzFGe98grYEc_iT260Nrq-N6DEmI&s=jhQ4ZJFK05kuQQVWd3xLGv2pzpV8z7NxgR2Q_UloTS0&e=>
>
> ---
> You received this message because you are subscribed to the Google
> Groups "ggplot2" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
ggplot2+u...@googlegroups.com
> <mailto:
ggplot2+u...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/ggplot2/b9e92c9b-ce9a-4b63-8092-8b33000e64c7n%40googlegroups.com
> <
https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_ggplot2_b9e92c9b-2Dce9a-2D4b63-2D8092-2D8b33000e64c7n-2540googlegroups.com-3Futm-5Fmedium-3Demail-26utm-5Fsource-3Dfooter&d=DwMFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=zImN_5GfvN5clExGCfuTCw&m=bTMuEPUthoJRJ64EzFGe98grYEc_iT260Nrq-N6DEmI&s=bFMtkeo4pSRTOQvrz9tH9dM0j2Ig5aOKUw8wIdbgKAI&e=>.