Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Meta forestplot variable columns not aligned

    Hi,

    I am trying to make a forest plot with some columns with descriptive info as strings. However, there seems to be some text alignment/justification issues for the column.

    Code to reproduce the issue:
    Code:
    clear all
    insobs 5
    gen es=0
    gen se=0.5
    gen category=""
    replace category = "Nospace" in 1
    replace category = "No_space_here" in 3
    replace category = "Definitely space and very long" in 2
    replace category = "Really another space and long" in 4
    replace category = "Margins-are-wrong-most-of-the-time" in 5
    meta set es se
    meta forestplot _id _plot _esci category
    This yields the following forest plot (notice the jumping text in the category column from one row to the next):
    Click image for larger version

Name:	messy_forest.png
Views:	1
Size:	89.3 KB
ID:	1776990



    Any idea on how to solve this? Thank you in advance.

    EDIT: Using StataNow/BE 18.5 (18 Dec 2024)
    Last edited by David Laursen; 06 May 2025, 06:21.

  • #2
    Thanks for the reproducible example. Consider:

    Code:
    clear all
    insobs 5
    gen es=0
    gen se=0.5
    gen category=""
    replace category = "Nospace" in 1
    replace category = "No_space_here" in 3
    replace category = "Definitely space and very long" in 2
    replace category = "Really another space and long" in 4
    replace category = "Margins-are-wrong-most-of-the-time" in 5
    meta set es se
    meta forestplot _id _plot _esci category, itemopts(justification(left))
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	61.8 KB
ID:	1776993

    Comment


    • #3
      Hi, David Laursen, you can specify itemopts:
      Code:
      meta forestplot _id _plot _esci category, itemopts(justification(left))

      Comment


      • #4
        Sorry for the cross with Andrew. I didn't refresh my web browser.

        Comment


        • #5
          Thank you for the helpful answers, Andrew and Chen. It worked!

          Comment

          Working...
          X