Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6762799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:24:07+00:00 2026-05-26T14:24:07+00:00

Is there an R library/function that would implement INTELLIGENT label placement in R plot?

  • 0
  1. Is there an R library/function that would implement INTELLIGENT label placement in R plot? I tried some but they are all problematic – many labels are overlapping either each other or other points (or other objects in the plot, but I see that this is much harder to handle).

  2. If not, is there any way how to COMFORTABLY help the algorithm with the label placement for particular problematic points? Most comfortable and efficient solution wanted.

You can play and test other possibilities with my reproducible example and see if you are able to achieve better results than I have:

# data
x = c(0.8846, 1.1554, 0.9317, 0.9703, 0.9053, 0.9454, 1.0146, 0.9012, 
0.9055, 1.3307)
y = c(0.9828, 1.0329, 0.931, 1.3794, 0.9273, 0.9605, 1.0259, 0.9542, 
0.9717, 0.9357)
ShortSci = c("MotAlb", "PruMod", "EriRub", "LusMeg", "PhoOch", "PhoPho", 
"SaxRub", "TurMer", "TurPil", "TurPhi")

# basic plot
plot(x, y, asp=1)
abline(h = 1, col = "green")
abline(v = 1, col = "green")

For labelling, I then tried these possibilities, no one is really good:

  1. this one is terrible:

    text(x, y, labels = ShortSci, cex= 0.7, offset = 10)

  2. this one is good if you don’t want to place labels for all points, but just for the
    outliers, but still, the labels are often placed wrong:

    identify(x, y, labels = ShortSci, cex = 0.7)

  3. this one looked promissing but there is the problem of labels being too close to the
    points; I had to pad them with spaces but this doesn’t help much:

    require(maptools)
    pointLabel(x, y, labels = paste(" ", ShortSci, " ", sep=""), cex=0.7)

  4. require(plotrix)
    thigmophobe.labels(x, y, labels = ShortSci, cex=0.7, offset=0.5)

require(calibrate)
textxy(x, y, labs=ShortSci, cx=0.7)

Thank you in advance!

EDIT: todo: try labcurve {Hmisc}.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:24:07+00:00Added an answer on May 26, 2026 at 2:24 pm

    I found some solution! It’s not ultimate and ideal unfortunatelly, but it’s the one that works the best for me now. It’s half algoritmic, half manual, so it saves time compared to pure manual solution sketched by joran.

    I overlooked very important part of the ?identify help!

    The algorithm used for placing labels is the same as used by text if
    pos is specified there, the difference being that the position of the
    pointer relative the identified point determines pos in identify.

    So if you use the identify() solution as I wrote in my question, then you can affect the position of the label by not clicking directly on that point, but by clicking next to that point relatively in the desired direction!!! Works just great!

    The downside is that there are only 4 positions (top, left, bottom, right), but I’d more appreciate the other 4 (top-left, top-right, bottom-left, bottom-right)… So I use this to labels points where it doesn’t bother me and the rest of the points I label directly in my Powerpoint presentation, as joran proposed 🙂

    P.S.: I haven’t tried the directlabels lattice/ggplot solution yet, I still prefer to use the basic plot library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a C library function that will return the index of a character
I'm investigating as to whether there is a framework/library that will help me implement
Is there any library function for this purpose, so I don't do it by
Question: Is there an easy way (library function) to perform a bitwise AND or
Is there an extended function library for sqlite? I am trying out sqlite and
Is there a function in the C Library under Linux which can set the
When loaded a shared library is opened via the function dlopen() , is there
Is there a way to execute SQL custom functions with Enterpise Library? I've tried
Is there a library method to copy all the properties between two (already present)
Ok, I tried all sorts of titles and they all failed (so if someone

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.