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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:32:42+00:00 2026-06-18T05:32:42+00:00

I have a scatter graph and have implemented a highlighter type thing through matplotlib

  • 0

I have a scatter graph and have implemented a highlighter type thing through matplotlib http://matplotlib.org/users/transforms_tutorial.html#axes-coordinates.

At the moment, when you click any of the points the highlighter appears at the same place, but what i want to do, is when you click a certain point, it takes the coordinates from the point and highlights where the point is.
my code is this

def onclick    
    ind = event.ind
    # the x coords of this transformation are data, and the
    # y coord are axes
    trans = transforms.blended_transform_factory(
    ax.transData, ax.transAxes)

    # highlight the 1..2 stddev region with a span.
    # We want x to be in data coordinates and y to
    # span from 0..1 in axes coords
    rect = patches.Rectangle((1,0), width=1, height=1,
                     transform=trans, color='yellow',
                     alpha=0.5)

    ax.add_patch(rect)
    print ('on pick scatter:' , ind , np.take(x,ind), np.take(y,ind))
  • 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-18T05:32:44+00:00Added an answer on June 18, 2026 at 5:32 am

    There is probably a shorter way to do this but this is my crack at it and it works 🙂

        def onpick3(event):
                ind = event.ind
        l = np.take(x,ind)
            for i in range(0,1):
                    d = l[i]
    
    
    
        if highlight == 1 :
    
            global highlight
            highlight = 0;
            self.canvas.draw()
                if highlight == 0 :
    
                trans = transforms.blended_transform_factory(self.axes.transData, self.axes.transAxes)
                    rect = patches.Rectangle(((d-10),0),width=25, height=25, transform=trans, color='yellow',alpha=0.5)
                    self.axes.add_patch(rect)
                self.canvas.draw()
            rect.remove()
            else:
             self.canvas.draw()
             trans = transforms.blended_transform_factory(self.axes.transData, self.axes.transAxes)
                 rect = patches.Rectangle(((d-10),0),width=25, height=25, transform=trans, color='yellow',alpha=0.5)
                 self.axes.add_patch(rect)
             self.canvas.draw()
             highlight = 1
             rect.remove()
                print ('onpick3 scatter:', ind, np.take(x, ind), np.take(y, ind))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a scatter graph i have created in matplotlib I also have a
i have a scatter plot graph i would like each dot to have a
I have a graph with multiple scatter plots in same plot area.... like the
I have a set of data that I'm plotting as a scatter graph which
I have two variables I want to plot on a scatter graph. I want
I have created a scatter graph with three plot spaces. One for two y-axis
In a 3D scatter graph of MATLAB I have 15 different clusters of data
I have a scatter plot in R (with ggplot2). The data has a numeric
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
I have a matplotlib figure that I want to be able to switch between

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.