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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:40:21+00:00 2026-05-19T04:40:21+00:00

I am trying to plot large amounts of points using some library. The points

  • 0

I am trying to plot large amounts of points using some library. The points are ordered by time and their values can be considered unpredictable.

My problem at the moment is that the sheer number of points makes the library take too long to render. Many of the points are redundant (that is – they are “on” the same line as defined by a function y = ax + b). Is there a way to detect and remove redundant points in order to speed rendering ?

Thank you for your time.

  • 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-19T04:40:22+00:00Added an answer on May 19, 2026 at 4:40 am

    The following is a variation on the Ramer-Douglas-Peucker algorithm for 1.5d graphs:

    1. Compute the line equation between first and last point
    2. Check all other points to find what is the most distant from the line
    3. If the worst point is below the tolerance you want then output a single segment
    4. Otherwise call recursively considering two sub-arrays, using the worst point as splitter

    In python this could be

    def simplify(pts, eps):
        if len(pts) < 3:
            return pts
        x0, y0 = pts[0]
        x1, y1 = pts[-1]
        m = float(y1 - y0) / float(x1 - x0)
        q = y0 - m*x0
        worst_err = -1
        worst_index = -1
        for i in xrange(1, len(pts) - 1):
            x, y = pts[i]
            err = abs(m*x + q - y)
            if err > worst_err:
                worst_err = err
                worst_index = i
        if worst_err < eps:
            return [(x0, y0), (x1, y1)]
        else:
            first = simplify(pts[:worst_index+1], eps)
            second = simplify(pts[worst_index:], eps)
            return first + second[1:]
    
    print simplify([(0,0), (10,10), (20,20), (30,30), (50,0)], 0.1)
    

    The output is [(0, 0), (30, 30), (50, 0)].

    About python syntax for arrays that may be non obvious:

    • x[a:b] is the part of array from index a up to index b (excluded)
    • x[n:] is the array made using elements of x from index n to the end
    • x[:n] is the array made using first n elements of x
    • a+b when a and b are arrays means concatenation
    • x[-1] is the last element of an array

    An example of the results of running this implementation on a graph with 100,000 points with increasing values of eps can be seen here.

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

Sidebar

Related Questions

I am trying to plot some waypoints using the Google-Earth toolbox . The documentation
I'm trying to plot a graph in real time using GNUplot and C++. Does
I am trying to plot a bunch of data points (many thousands) in Python
When trying to plot a normal PDF with mean=0 and standard deviation=20 using the
I'm trying to plot MGRS lines over a map in an overlay using OpenLayers
I have the following problem when trying to plot some 3D data in Mathematica.
Trying to setup an SSH server on Windows Server 2003. What are some good
Trying to find some simple SQL Server PIVOT examples. Most of the examples that
Trying to make a make generic select control that I can dynamically add elements
Trying to do this sort of thing... WHERE username LIKE '%$str%' ...but using bound

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.