Announcement

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

  • overlapping mlabels in scatterplot

    When you run scatter x y, mlabel(z), you can end up with a scatterplot that is unreadable because the text labeling different points overlaps.

    Is there a solution to this? I thought of two possibilities, neither of which has worked out yet:
    • [*=1]The best solution would be a smarter version of the scatter command which moves the labels around so they don't overlap. [*=1]Failing that, the next best solution would be to move the labels around in Stata's Graph editor. However, when I open the Graph Editor it does not appear that I can edit the labels for individual points.
    Better ideas are most welcome. Thanks!

  • #2
    See the egen function mlabvpos() (Ulrich Kohler) in the egenmore package (SSC).

    Comment


    • #3
      Ah, yes. Now I see this similar thread from 2013: https://www.stata.com/statalist/arch.../msg01170.html

      The thread highlights mlabvpos(), which is an improvement over mlabel(). But imperfect since mlabvpos() is manual and doesn't necessarily avoid overlap.

      The original poster, Stefan Gawrich, came back with a loop that calculated mlapvpos() positions to try and avoid overlap: https://www.stata.com/statalist/arch.../msg01256.html

      Further automation may be possible.

      Comment


      • #4
        No; the egen function mlabvpos() I referred to is not the same as the mlabvpos() option of twoway. Perhaps a confusing function name, but there is no scope for confusing the syntax in practice.

        Comment


        • #5
          I'm not sure there's any confusion here. The 2013 thread refers to the egen function mlabvpos(), doesn't it?

          What I am confused about is why I can't edit marker labels in Stata's Graph Editor.
          Last edited by paulvonhippel; 29 May 2018, 15:04.

          Comment


          • #6
            Paul: I am writing for all readers. My point is that the egen function and the option with the same name are different beasts. If you are clear on that, then fine. But the egen function is not manual, in any sense I know: it's automated.

            I can edit a marker label in the Graph Editor or its properties by clicking on a data point and going for marker label properties or observation properties. Perhaps you're missing that to change the label itself, you click on observation properties.

            Comment


            • #7
              Thanks for the suggestions, Nick! In the Graph Editor, when I click a datapoint, all the data points are highlighted. Can you highlight a single datapoint on a scatterplot?

              Comment

              Working...
              X