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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:58:14+00:00 2026-06-10T06:58:14+00:00

I create a simple scatter plot with ggplot2 and visualise the z-variable with a

  • 0

I create a simple scatter plot with ggplot2 and visualise the z-variable with a color:

 require(ggplot2)

 data = data.frame(x=runif(1000), y=runif(1000), vis=rf(1000, df1=1, df2=3))
 qplot(x=x, y=y, data=data, color=vis)

however, this is of course not very informative since the distribution is heavily skewed:

 hist(data$vis)

the problem – in my opinion – is the equidistant breaks that creates bins for data that is simply not in the sample.

so here is my question: is there an efficient way of overcoming this problem and creating more breaks where more data is available. or in other words i’m looking for non-linear breaks or non-equidistant braks.

  • 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-10T06:58:15+00:00Added an answer on June 10, 2026 at 6:58 am

    Edit: probably something more similar to what you want:

    breaks <- quantile(data$vis)
    qplot(x=x, y=y, data = data, color = vis) + 
         scale_colour_gradientn(breaks = as.vector(breaks), colours = 
         c("grey", "blue", "red"), values = as.vector(breaks), 
         oob = identity, rescaler = function(x,...) x, labels = names(breaks))
    

    enter image description here

    Old answer: In this case breaks are not what you really want

    qplot(x=x, y=y, data=data, color=vis) + scale_colour_gradient(breaks = 1:10 * 10)
    

    enter image description here

    Considering amount of data we have

    quantile(data$vis, seq(0, 1, 0.1))
              0%          10%          20%          30%          40% 
    9.294095e-07 1.883887e-02 8.059213e-02 1.646752e-01 3.580304e-01 
             50%          60%          70%          80%          90% 
    6.055612e-01 9.463869e-01 1.638687e+00 2.686160e+00 5.308239e+00 
            100% 
    1.693077e+02 
    

    so possibly something like

    qplot(x=x, y=y, data=data, color=vis) + scale_colour_gradient(limits = c(0,5))
    

    enter image description here

    would be good, here points > 5 are grey. A more complicated solution, which you maybe wanted in the first place would be this.

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

Sidebar

Related Questions

I'm trying to create a pretty simple scatter plot with two data series. I
I am trying to create a simple scatter plot with PlotSymbols for when I
I've created a simple scatter plot in R with specific RGB color values like
I create simple style.xml file <style name=You.EditText.Style parent=@android:style/Widget.EditText> <item name=android:textColor>@color/colorRed</item> <item name=android:gravity>center</item> </style> But
I have create simple line chart using Android Plot library. what i want to
I am trying to create simple GPS application just to display simple data in
I'm trying to create simple script that subscribes a user to a company calendar.
I want to create simple app able to edit images. Main view of app
I know how to create simple object and add dynamically properties to it. object
I would like to create simple objects at runtime (textbox, label, etc) and add

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.