Find y value for respective x from python plot (matplotlib)Calling a function of a module by using its name (a string)Finding the index of an item given a list containing it in PythonHow do I return multiple values from a function?Getting the class name of an instance?Convert bytes to a string?Hiding axis text in matplotlib plotsWhy is reading lines from stdin much slower in C++ than Python?Save plot to image file instead of displaying it using MatplotlibHow to make IPython notebook matplotlib plot inlineWhy is “1000000000000000 in range(1000000000000001)” so fast in Python 3?
Does the Grothendieck group of finitely generated modules form a commutative ring where the multiplication structure is induced from tensor product?
How might boat designs change in order to allow them to be pulled by dragons?
Trace in the category of propositional statements
How to extract coefficients of a generating function like this one, using a computer?
What was the point of separating stdout and stderr?
To “Er” Is Human
"Best practices" for formulating MIPs
Are the Gray and Death Slaad's Bite and Claw attacks magical?
Cannot overlay, because ListPlot does not draw same X range despite the same PlotRange
Confusion in understanding the behavior of inductor in RL circuit with DC source
Simplify the code
GFCI versus circuit breaker
Searching for single buildings in QGIS
Replacing 5 gang light switches that have 3 of them daisy chained together
Are there advantages in writing by hand over typing out a story?
How can I change my buffer system for protein purification?
German idiomatic equivalents of 能骗就骗 (if you can cheat, then cheat)
What is the point of using the kunai?
What happened to the Apollo 1 rocket?
How come having a Deathly Hallow is not a big deal?
Does friction always oppose motion?
What caused the flashes in the video footage of Chernobyl?
What could a Medieval society do with excess animal blood?
How can solar sailed ships be protected from space debris?
Find y value for respective x from python plot (matplotlib)
Calling a function of a module by using its name (a string)Finding the index of an item given a list containing it in PythonHow do I return multiple values from a function?Getting the class name of an instance?Convert bytes to a string?Hiding axis text in matplotlib plotsWhy is reading lines from stdin much slower in C++ than Python?Save plot to image file instead of displaying it using MatplotlibHow to make IPython notebook matplotlib plot inlineWhy is “1000000000000000 in range(1000000000000001)” so fast in Python 3?
I'm trying to find the code to find the value of 'y' to a respective 'x' value by using a plotted line graph.
I've used matplotlib.pyplot to plot a graph.
The 'x' value for which I want the 'y' value is not a part of the x values array. Is there a way to find the respective 'y' value for the same?
If I have to find the value of Y for X = 0.75, how do I do that?
python matplotlib
add a comment |
I'm trying to find the code to find the value of 'y' to a respective 'x' value by using a plotted line graph.
I've used matplotlib.pyplot to plot a graph.
The 'x' value for which I want the 'y' value is not a part of the x values array. Is there a way to find the respective 'y' value for the same?
If I have to find the value of Y for X = 0.75, how do I do that?
python matplotlib
1
You could try fitting a linear regression on your first two data points, then use the slope and intercept from that to get the equation for the line between them. Then plug in the x-value you want to find the corresponding y-value.
– HS-nebula
Mar 25 at 17:32
add a comment |
I'm trying to find the code to find the value of 'y' to a respective 'x' value by using a plotted line graph.
I've used matplotlib.pyplot to plot a graph.
The 'x' value for which I want the 'y' value is not a part of the x values array. Is there a way to find the respective 'y' value for the same?
If I have to find the value of Y for X = 0.75, how do I do that?
python matplotlib
I'm trying to find the code to find the value of 'y' to a respective 'x' value by using a plotted line graph.
I've used matplotlib.pyplot to plot a graph.
The 'x' value for which I want the 'y' value is not a part of the x values array. Is there a way to find the respective 'y' value for the same?
If I have to find the value of Y for X = 0.75, how do I do that?
python matplotlib
python matplotlib
asked Mar 25 at 17:27
shellymshellym
1797 bronze badges
1797 bronze badges
1
You could try fitting a linear regression on your first two data points, then use the slope and intercept from that to get the equation for the line between them. Then plug in the x-value you want to find the corresponding y-value.
– HS-nebula
Mar 25 at 17:32
add a comment |
1
You could try fitting a linear regression on your first two data points, then use the slope and intercept from that to get the equation for the line between them. Then plug in the x-value you want to find the corresponding y-value.
– HS-nebula
Mar 25 at 17:32
1
1
You could try fitting a linear regression on your first two data points, then use the slope and intercept from that to get the equation for the line between them. Then plug in the x-value you want to find the corresponding y-value.
– HS-nebula
Mar 25 at 17:32
You could try fitting a linear regression on your first two data points, then use the slope and intercept from that to get the equation for the line between them. Then plug in the x-value you want to find the corresponding y-value.
– HS-nebula
Mar 25 at 17:32
add a comment |
1 Answer
1
active
oldest
votes
We can use the interp function from numpy library.
import numpy as np
x = [0.01474926, 0.96923077, 1]
y = [1, 0.7875, 0]
np.interp(0.75, x,y)
0.8363082148652623
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343417%2ffind-y-value-for-respective-x-from-python-plot-matplotlib%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
We can use the interp function from numpy library.
import numpy as np
x = [0.01474926, 0.96923077, 1]
y = [1, 0.7875, 0]
np.interp(0.75, x,y)
0.8363082148652623
add a comment |
We can use the interp function from numpy library.
import numpy as np
x = [0.01474926, 0.96923077, 1]
y = [1, 0.7875, 0]
np.interp(0.75, x,y)
0.8363082148652623
add a comment |
We can use the interp function from numpy library.
import numpy as np
x = [0.01474926, 0.96923077, 1]
y = [1, 0.7875, 0]
np.interp(0.75, x,y)
0.8363082148652623
We can use the interp function from numpy library.
import numpy as np
x = [0.01474926, 0.96923077, 1]
y = [1, 0.7875, 0]
np.interp(0.75, x,y)
0.8363082148652623
answered Mar 25 at 17:33
Siong Thye GohSiong Thye Goh
2,2197 gold badges14 silver badges22 bronze badges
2,2197 gold badges14 silver badges22 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343417%2ffind-y-value-for-respective-x-from-python-plot-matplotlib%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You could try fitting a linear regression on your first two data points, then use the slope and intercept from that to get the equation for the line between them. Then plug in the x-value you want to find the corresponding y-value.
– HS-nebula
Mar 25 at 17:32