Getting x,y values from seaborn relplot

With code I can plot starfields in size and color ,very good.
what I like to do now is, hovering or click on a star and then extra information from that star pops up.
to achieve this, I was thinking this way:
every time the code plots a star in the graphic there is information about the x,y value, catch this value in a dataframe together with the star ID. simple ? it isn’t.
this is a acutelly the code who does the plot work.


sns.relplot(x='ra', y='dec', height=8.5, aspect=1.2, legend=None,
        hue='bp_rp',
        palette='RdYlBu_r',
        size='R_sun',
        sizes=(1,rr1['R_sun'].max()/rr1['R_sun'].min()),
        data=rr1
        )

So in the script this is a loop, so everytime the relplot plots new data on the graph (x,y) from the dataframe.
I like to catch these x,y values to store in a dataframe.

what i,m struggling with is how to get the seaborn relplot x,y values. so I can store them in a dataframe.

I searched and tried many lecture and code but I cant get these x,y values, maybe somebody has an Idea? or a better way?
thanks for answers.
with kind regards…

Willie.

I’m not sure I quite understand the question, because for a scatterplot, the x/y values in the plot are just the x/y values in the data that you provide. Some of the other functions will do aggregations/transformations that it might be cumbersome to replicate externally, but it seems that you’re asking for a data structure that you already poseses.

You can accomplish some fairly complex custom interactivity using the matplotlib callback system, but I am not an expert on these tools and would struggle to provide an optimal example.

Michael , thanks for your reply, maybe youre right, but its a relplot not a scatter plot, the x,y data are
astronomical values, so there are not x,y values.
Its not clear for me how relplot plots the x,y coordinates in respect to the ra, dec values.
somehow relplot translate ra (27:40:12) value to a coordinate in the graph.so a x value, how to get that x value.

Willie.

A relplot is just a scatterplot + FacetGrid. But I am afraid I don’t know anything about astronomical data and don’t understand why they would not be “x,y values” … I think you’ll need to provide more context about your dataset.

Michael, my dataset is huge…it looks leke this. small part…

|3.02920824309838|115.514662733389|-14.8507044657302|
|3.02920827745809|115.537058935438|-14.8511198629551|
|3.02920827745811|115.53249594027|-14.8603029129208|
|3.02920827746045|115.529037495212|-14.8577389638869|
|3.02920831181781|115.549398373905|-14.8463766889482|
|3.02920834617915|115.514785650145|-14.8442768208855|
|3.02920837623688|115.53036499201|-14.8408325125166|
|3.02920837623689|115.538294154124|-14.8378598526807|
|3.0292083805373|115.532943563244|-14.8315840776213|
|3.02920838053889|115.530113574335|-14.8334407166108|
|3.02920838053889|115.528916707416|-14.8359709429076|
|3.02920841059651|115.452510947124|-14.8899607348842|
|3.02920841489864|115.444124735635|-14.8847158270988|

are these 115.514662733389|, -14.8507044657302 the x,y values on the plot?

is there an onclick or hoover event in seaborn relplot?

Seaborn does not offer any additional features for interactivity, but because it’s all based on matplotlib, you can make the plots that seaborn produces interactive by using matplotlib tools. Depending on what exactly you’re trying to do, you may find that seaborn’s abstractions get in the way, and that it is simpler to build an interactive application just using matplotlib.

It’s hard to give a general suggestion because it will probably depend a bit on what exactly you’re trying to do and on your level of knowledge about the two libraries.

It would be easier to advise on your project if you could share a complete (i.e. runnable) example of how your data are structured and what you have done so far. You don’t need to share your complete dataset, just enough to demonstrate the basic functionality. There are some helpful guidelines on this page.

Michael, sorry for the late reply, busy on the house…I will look at your writing.

thanks.

Willie.