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

  • SEARCH
  • Home
  • 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 7936415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:12:29+00:00 2026-06-03T22:12:29+00:00

I plot here values over length for a chromosome The middle region without points

  • 0

I plot here values over length for a chromosome

enter image description here

The middle region without points contains no data and should not get a loess line.
How can I modify my code to stop the loess line over this region?
The data is continuous but I could add lines to mark the blank region with some special value or add a column with a label?? but how to use this in the command?

my current command:

library(IDPmisc)

# plot settings (edit here)
spanv<-0.05
pointcol1="#E69F00"
pointcol2="#56B4E9"
pointcol3="#009E73"
points=20
linecol="green"
xlabs=paste(onechr, " position", " (loess-span=", spanv, ")", sep="")

data1<-NaRV.omit(data[,c(2,7)]) # keep only x and y for the relevant data 
                                # and clean NA and Inf
ylabs='E / A - ratio'
p1<-ggplot(data1, aes(x=start, y=E.R)) +
ylim(0,5) +
geom_point(shape=points, col=pointcol1, na.rm=T) +
geom_hline(aes(yintercept=1, col=linecol)) +
geom_smooth(method="loess", span=spanv, fullrange=F, se=T, na.rm=T) +
xlab(xlabs) +
ylab(ylabs)
  • 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-06-03T22:12:30+00:00Added an answer on June 3, 2026 at 10:12 pm

    I would do one of two things:

    1. Do the loess() fitting outside of ggplot(), predict for the two regions separately and add each set of predictions to the plot with its own geom_line() layer.
    2. Similar to the above, but this time within ggplot() realm of operations. Add two layers to the plot, not one, both using geom_smooth(), but importantly change the data argument supplied to each to refer to just one or the other portion of data.

    For the latter, perhaps something like:

    ....
    geom_smooth(data = data[1:n, ], method="loess", span=spanv, fullrange=FALSE, 
                se=TRUE, na.rm=TRUE) +
    geom_smooth(data = data[m:k, ], method="loess", span=spanv, fullrange=FALSE, 
                se=TRUE, na.rm=TRUE)
    ....
    

    where n and m and k refer to the indices that mark the end of set 1 and the start and end of set 2 and which need to be defined or supplied by you directly.

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

Sidebar

Related Questions

I use Google Visualization API to plot Line Chart. Here are the codes: google.load(visualization,
I am using matplotlib and numpy to make a polar plot. Here is some
I just wonder how to add annotation in matlab plot? Here is my code:
I plot complex data using QwtPlot, so, I reimplement QwtSeriesData for converting my data
I have a scatter plot in R (with ggplot2). The data has a numeric
I'm using R. I have 25 variables over 15 time points, with 3 or
I have a bunch of measurements over time and I want to plot them
I'm trying to plot two sets of data wrt to time on the same
Is there a way to set the length of a data series using Google
I have a NetCDF file, which contains data representing total precipitation across the globe

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.