Answer the question
In order to leave comments, you need to log in
How to determine the value of X and Y by clicking the cursor on the plot area?
How to create an XY area for a future chart, where you can click the cursor on any valid value from X to Y, and find out the exact coordinates of the point after pressing ?
Answer the question
In order to leave comments, you need to log in
First you need to select the library in which the graph will be drawn. the simplest, even children are taught on it - this is a turtle. It can make simple games and read click coordinates
https://docs.python.org/3/library/turtle.html
mathematics? graph is the graph of a function?
When you draw a graph yourself, you must implement a formula that calculates screenX and screenY from x and y=F(x) of your graph, i.e. coordinates (most often in pixels) of points on the screen,
respectively, the reverse process, from a click on the screen, you need to write an inverse transformation
if X is usually simple, let minx and maxx be the minimum and maximum values \u200b\u200bon the graph for x, and the graph is drawn on the screen from minScreenX to maxScreenX, then calculating the point screenx = ((x-minx)*(maxScreenX-minScreenX)/(maxx-minx))+minScreenX counts screeny
in the same way, but instead of x you take y=f(x), miny, maxy and minScreenY, maxScreenY respectively
the inverse transformation for x will not be a problem, this is a school course, but for y it’s a little more complicated, if f (x) can analytically derive the inverse function x = FF (y) then everything is simple, otherwise, there is an easy way - to store in memory in array all function values for each screenX point on the screen as an associative array ff[x]=[...] and use it instead of the inverse function
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question