• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Limiting vertical line length in R ggplot2

Resolved: Limiting vertical line length in R ggplot2

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I am trying to draw a forest plot with different groups. The code I’m using looks like the following:
And the resulting plot: enter image description here
The vertical lines (2, 2.5) are the true group means. I want to limit these vertical lines to be within each group (i.e., the first one from bottom to the middle, the second one middle to top). Anyone know how to do this?
I’ve tried geom_segment() function but I think it requires a numerical y input, while it’s a factor here.
Thanks in advance!

Answer:

Factors plotted on an axis are “really” numeric, but with labels added, so you can go ahead and add numeric segments:
enter image description here
Or, with a few tweaks:
enter image description here

If you have better answer, please add a comment about this, thank you!

ggplot2 r
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How can I copy files using the ansible.builtin.copy module and avoid conflicting file names?

26/03/2023

Resolved: Reshape tensors of unknown shape with tf.function

26/03/2023

Resolved: Use Svelte Component as Slot

26/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.