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 5993391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:40:07+00:00 2026-05-22T23:40:07+00:00

I would like to jitter the text on a plot so as to avoid

  • 0

I would like to jitter the text on a plot so as to avoid overplotting. To do so, I assume that I need a bounding box around the text component. Is there a way to get this?

For example, in base graphics:

plot.new()
text(.5,.5,"word")
text(.6,.5,"word") #does this overlap?

In grid there is a way to drop overlapping text, but I can’t seem to find a way to access the code that figures out if overlapping has occurred.

grid.text(c("word","other word"),c(.5,.6),c(.5,.5),check=T)
  • 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-22T23:40:07+00:00Added an answer on May 22, 2026 at 11:40 pm

    Maybe the strwidth and strheight functions can help here

    stroverlap <- function(x1,y1,s1, x2,y2,s2) {
      sh1 <- strheight(s1)
      sw1 <- strwidth(s1)
      sh2 <- strheight(s2)
      sw2 <- strwidth(s2)
    
      overlap <- FALSE
      if (x1<x2) 
        overlap <- x1 + sw1 > x2
      else
        overlap <- x2 + sw2 > x1
    
      if (y1<y2)
        overlap <- overlap && (y1 +sh1>y2)
      else
        overlap <- overlap && (y2+sh2>y1)
    
      return(overlap)
    }
    stroverlap(.5,.5,"word", .6,.5, "word")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Would like to know if there is any resource on the web that conveniently
Would like to know options in 3D graphics engines out there that can even
Would like to ask for advice. there is a need for binary to have
Would like to create a strong password in C++. Any suggestions? I assume it
Would like to make anapplication in Java that will not automatically parse parameters used
I would like to use a language that I am familiar with - Java,
I would like a C# algorithm that re-arranges the chars in a string that
would like to create a function that generates graphs using ggplot. For the sake
would like to allow visitors to a web page to upload photos that will
Would like to hide some text inside a div-block, but I don't want to

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.