Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First, here's the results of my solution to this problem:</p> <p><img src="https://i.stack.imgur.com/gX135.png" alt="enter image description here"></p> <p>I did this by hand in Preview (very basic PDF/image viewer on OS X) in just a few minutes. (<em>Edit:</em> The workflow was exactly what you'd expect: I saved the plot as a PDF from R, opened it in Preview and created textboxes with the desired labels (9pt Helvetica) and then just dragged them around with my mouse until they looked good. Then I exported to a PNG for uploading to SO.)</p> <p>Now, before you succumb to the strong urge to down vote this into oblivion and leave snarky comments about how the point is to automate this process, hear me out!</p> <p>Looking for algorithmic solutions is totally fine, and (IMHO) really interesting. But, to me, point labeling situations fall into roughly three categories:</p> <ol> <li><em>You have a small number of points, none which are terribly close together</em>. In this case, one of the solutions you listed in the question is likely to work with fairly minimal tweaking.</li> <li><em>You have a small number of points, some of which are too closely packed for the typical algorithmic solutions to give good results</em>. In this case, since you only have a small number of points, labeling them by hand (either with an image editor or fine-tuning your call to <code>text</code>) isn't <em>that</em> much effort.</li> <li><em>You have a fairly large number of points</em>. In this case, you really shouldn't be labeling them anyway, since it's hard to process large numbers of labels visually.</li> </ol> <p>:climbing onto soapbox:</p> <p>Since folks like us <em>love</em> automation, I think we often fall into the trap of thinking that nearly every aspect of producing a good statistical graphic ought to be automated. I respectfully (humbly!) disagree.</p> <p>There is no perfectly general statistical plotting environment that automagically creates the picture you have in your head. Things like R, ggplot2, lattice etc. do <em>most</em> of the work; but that extra little bit of tweaking, adding a line here, adjusting a margin there, is probably better suited to a different tool.</p> <p>:climbing down from soapbox:</p> <p>I would also note that I think we could all come up with scatterplots with &lt;10-15 points that will be nearly impossible to cleanly label, even by hand, and these will likely break any automatic solution someone comes up with.</p> <p>Finally, I want to reiterate that I <em>know</em> this isn't the answer you're looking for. And I'm <em>not</em> saying that algorithmic attempts are useless or dumb. I up-voted this question, and will happily upvote interesting algorithmic solutions! </p> <p>The reason I posted this answer is that I think this question ought to be the canonical "point labeling in R" question for future duplicates, and I think solutions involving hand-labeling deserve a seat at the table, that's all.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload