How to add line connecting two coordinates on a graph with logarithmic x-axis scale?How to set the horizontal...

When should a commit not be version tagged?

Borrowing Characters

Is the set of paths between any two points moving only in units on the plane countable or uncountable?

How to make a mimic a challenging fight for high level party?

Make me a metasequence

When was drinking water recognized as crucial in marathon running?

Is there a frame of reference in which I was born before I was conceived?

Non-Italian European mafias in USA?

Why do members of Congress in committee hearings ask witnesses the same question multiple times?

Levi-Civita symbol: 3D matrix

Rationale to prefer local variables over instance variables?

Sometimes a banana is just a banana

Is there a math equivalent to the conditional ternary operator?

Book about a time-travel war fought by computers

Graphing random points on the XY-plane

Is it possible to keep the Ring of Winter if you manage to acquire it?

Find how "smooth" a number is based on binary

Are there any other Chaos worshipping races?

my breadboard simulation doesn't work properly

Where is the line between being obedient and getting bullied by a boss

Can I send almost 1MB transaction?

I can't die. Who am I?

How can I handle a player who pre-plans arguments about my rulings on RAW?

Can a space-faring robot still function over a billion years?



How to add line connecting two coordinates on a graph with logarithmic x-axis scale?


How to set the horizontal separation of group of rectanglesHistogram fill with logarithmic scaleHow do i get the x axis on top but keep a line on the bottomLogarithmic y-scale with zero bin valueHow to make part of x-axis normal scale and other logarithmic scale in pgfplots?Keep position of coordinates with different axis-scalePgfplot with logarithmic x-axis to zeroShow mark labels near marks and not centered in ybar interaval graphpgfplots: percentage in matrix plotCenter the axes in the coordinate originHow to change coordinates in axis scale?













2















I am trying to add the line going through the points (1000,-8.5) and (10000,-27.79). This is the latex I have so far.



begin{figure}[h!]
begin{center}
begin{tikzpicture}
begin{axis}[
xmode=log,
xlabel={Frequency (Hz)},
ylabel={Gain (db)},
xmin=0, xmax=20000,
ymin=-30, ymax=10,
xtick={0,100,1000,10000},
ytick={10,0,-10,-20,-30},
legend pos=north west,
ymajorgrids=true,
grid style=dashed,
]

addplot[
color=blue,
mark=square,
only marks,
]
coordinates {
(100,-0.18)(1000,-8.5)(2000,-14.15)(4000,-19.83)(10000,-27.79)
};

% add plot of equation going through points (1000,-8.5) and (10000,-27.79) here

end{axis}
end{tikzpicture}
end{center}
end{figure}


All the equations passing through those two points don't show up correctly on the plot, I'm guessing because the logarithmic scale. I have tried 49.37-19.29*x but that doesn't work. That equation is reached by applying log(x) before calculating the line connecting the two points. How do I get a line passing through those points?










share|improve this question







New contributor




Tom Finet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Welcome to TeX.SE! addplot[no marks] coordinates {(1000,-8.5) (10000,-27.79)}; ?

    – marmot
    23 hours ago
















2















I am trying to add the line going through the points (1000,-8.5) and (10000,-27.79). This is the latex I have so far.



begin{figure}[h!]
begin{center}
begin{tikzpicture}
begin{axis}[
xmode=log,
xlabel={Frequency (Hz)},
ylabel={Gain (db)},
xmin=0, xmax=20000,
ymin=-30, ymax=10,
xtick={0,100,1000,10000},
ytick={10,0,-10,-20,-30},
legend pos=north west,
ymajorgrids=true,
grid style=dashed,
]

addplot[
color=blue,
mark=square,
only marks,
]
coordinates {
(100,-0.18)(1000,-8.5)(2000,-14.15)(4000,-19.83)(10000,-27.79)
};

% add plot of equation going through points (1000,-8.5) and (10000,-27.79) here

end{axis}
end{tikzpicture}
end{center}
end{figure}


All the equations passing through those two points don't show up correctly on the plot, I'm guessing because the logarithmic scale. I have tried 49.37-19.29*x but that doesn't work. That equation is reached by applying log(x) before calculating the line connecting the two points. How do I get a line passing through those points?










share|improve this question







New contributor




Tom Finet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Welcome to TeX.SE! addplot[no marks] coordinates {(1000,-8.5) (10000,-27.79)}; ?

    – marmot
    23 hours ago














2












2








2








I am trying to add the line going through the points (1000,-8.5) and (10000,-27.79). This is the latex I have so far.



begin{figure}[h!]
begin{center}
begin{tikzpicture}
begin{axis}[
xmode=log,
xlabel={Frequency (Hz)},
ylabel={Gain (db)},
xmin=0, xmax=20000,
ymin=-30, ymax=10,
xtick={0,100,1000,10000},
ytick={10,0,-10,-20,-30},
legend pos=north west,
ymajorgrids=true,
grid style=dashed,
]

addplot[
color=blue,
mark=square,
only marks,
]
coordinates {
(100,-0.18)(1000,-8.5)(2000,-14.15)(4000,-19.83)(10000,-27.79)
};

% add plot of equation going through points (1000,-8.5) and (10000,-27.79) here

end{axis}
end{tikzpicture}
end{center}
end{figure}


All the equations passing through those two points don't show up correctly on the plot, I'm guessing because the logarithmic scale. I have tried 49.37-19.29*x but that doesn't work. That equation is reached by applying log(x) before calculating the line connecting the two points. How do I get a line passing through those points?










share|improve this question







New contributor




Tom Finet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I am trying to add the line going through the points (1000,-8.5) and (10000,-27.79). This is the latex I have so far.



begin{figure}[h!]
begin{center}
begin{tikzpicture}
begin{axis}[
xmode=log,
xlabel={Frequency (Hz)},
ylabel={Gain (db)},
xmin=0, xmax=20000,
ymin=-30, ymax=10,
xtick={0,100,1000,10000},
ytick={10,0,-10,-20,-30},
legend pos=north west,
ymajorgrids=true,
grid style=dashed,
]

addplot[
color=blue,
mark=square,
only marks,
]
coordinates {
(100,-0.18)(1000,-8.5)(2000,-14.15)(4000,-19.83)(10000,-27.79)
};

% add plot of equation going through points (1000,-8.5) and (10000,-27.79) here

end{axis}
end{tikzpicture}
end{center}
end{figure}


All the equations passing through those two points don't show up correctly on the plot, I'm guessing because the logarithmic scale. I have tried 49.37-19.29*x but that doesn't work. That equation is reached by applying log(x) before calculating the line connecting the two points. How do I get a line passing through those points?







tikz-pgf pgfplots






share|improve this question







New contributor




Tom Finet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Tom Finet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Tom Finet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









Tom FinetTom Finet

232




232




New contributor




Tom Finet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Tom Finet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Tom Finet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • Welcome to TeX.SE! addplot[no marks] coordinates {(1000,-8.5) (10000,-27.79)}; ?

    – marmot
    23 hours ago



















  • Welcome to TeX.SE! addplot[no marks] coordinates {(1000,-8.5) (10000,-27.79)}; ?

    – marmot
    23 hours ago

















Welcome to TeX.SE! addplot[no marks] coordinates {(1000,-8.5) (10000,-27.79)}; ?

– marmot
23 hours ago





Welcome to TeX.SE! addplot[no marks] coordinates {(1000,-8.5) (10000,-27.79)}; ?

– marmot
23 hours ago










1 Answer
1






active

oldest

votes


















3














How about



documentclass[tikz,border=3.14mm]{standalone}

usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
begin{tikzpicture}
begin{axis}[
xmode=log,
xlabel={Frequency (Hz)},
ylabel={Gain (db)},
xmin=0, xmax=20000,
ymin=-30, ymax=10,
xtick={0,100,1000,10000},
ytick={10,0,-10,-20,-30},
legend pos=north west,
ymajorgrids=true,
grid style=dashed,
legend pos=north east
]

addplot[
color=blue,
mark=square,
only marks,
]
coordinates {
(100,-0.18)(1000,-8.5)(2000,-14.15)(4000,-19.83)(10000,-27.79)
};
addlegendentry{data}

addplot[color=orange,no marks] coordinates {(1000,-8.5) (10000,-27.79)};
addlegendentry{fit}
end{axis}
end{tikzpicture}
end{document}


enter image description here






share|improve this answer
























  • I think (s)he wants the equation in the legend. (Already provided in his question I think -but didn't solved- See his comment on my deleted answer)

    – koleygr
    23 hours ago








  • 1





    @koleygr Thanks! One can replace addlegendentry{fit} by addlegendentry{$E=mc^2$}, say, to get an equation. Please consider changing your answer tex.stackexchange.com/a/477600/121799. You need only something like node [whtblock, right=3cm of PHY,font=fontsize{12}{0}selectfont]. In your answer, all the node distance keys have no effect because they are to be placed earlier. That is, remove all node distance statements and put the distance in the below of and so on keys.

    – marmot
    23 hours ago











  • Ok fixed... Didn't realized what you said at first time and thought that I have to study things to make the requested edit and know what I am doing. But what you said was simple and thus, edited the question. thanks

    – koleygr
    22 hours ago











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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
});


}
});






Tom Finet is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f477748%2fhow-to-add-line-connecting-two-coordinates-on-a-graph-with-logarithmic-x-axis-sc%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









3














How about



documentclass[tikz,border=3.14mm]{standalone}

usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
begin{tikzpicture}
begin{axis}[
xmode=log,
xlabel={Frequency (Hz)},
ylabel={Gain (db)},
xmin=0, xmax=20000,
ymin=-30, ymax=10,
xtick={0,100,1000,10000},
ytick={10,0,-10,-20,-30},
legend pos=north west,
ymajorgrids=true,
grid style=dashed,
legend pos=north east
]

addplot[
color=blue,
mark=square,
only marks,
]
coordinates {
(100,-0.18)(1000,-8.5)(2000,-14.15)(4000,-19.83)(10000,-27.79)
};
addlegendentry{data}

addplot[color=orange,no marks] coordinates {(1000,-8.5) (10000,-27.79)};
addlegendentry{fit}
end{axis}
end{tikzpicture}
end{document}


enter image description here






share|improve this answer
























  • I think (s)he wants the equation in the legend. (Already provided in his question I think -but didn't solved- See his comment on my deleted answer)

    – koleygr
    23 hours ago








  • 1





    @koleygr Thanks! One can replace addlegendentry{fit} by addlegendentry{$E=mc^2$}, say, to get an equation. Please consider changing your answer tex.stackexchange.com/a/477600/121799. You need only something like node [whtblock, right=3cm of PHY,font=fontsize{12}{0}selectfont]. In your answer, all the node distance keys have no effect because they are to be placed earlier. That is, remove all node distance statements and put the distance in the below of and so on keys.

    – marmot
    23 hours ago











  • Ok fixed... Didn't realized what you said at first time and thought that I have to study things to make the requested edit and know what I am doing. But what you said was simple and thus, edited the question. thanks

    – koleygr
    22 hours ago
















3














How about



documentclass[tikz,border=3.14mm]{standalone}

usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
begin{tikzpicture}
begin{axis}[
xmode=log,
xlabel={Frequency (Hz)},
ylabel={Gain (db)},
xmin=0, xmax=20000,
ymin=-30, ymax=10,
xtick={0,100,1000,10000},
ytick={10,0,-10,-20,-30},
legend pos=north west,
ymajorgrids=true,
grid style=dashed,
legend pos=north east
]

addplot[
color=blue,
mark=square,
only marks,
]
coordinates {
(100,-0.18)(1000,-8.5)(2000,-14.15)(4000,-19.83)(10000,-27.79)
};
addlegendentry{data}

addplot[color=orange,no marks] coordinates {(1000,-8.5) (10000,-27.79)};
addlegendentry{fit}
end{axis}
end{tikzpicture}
end{document}


enter image description here






share|improve this answer
























  • I think (s)he wants the equation in the legend. (Already provided in his question I think -but didn't solved- See his comment on my deleted answer)

    – koleygr
    23 hours ago








  • 1





    @koleygr Thanks! One can replace addlegendentry{fit} by addlegendentry{$E=mc^2$}, say, to get an equation. Please consider changing your answer tex.stackexchange.com/a/477600/121799. You need only something like node [whtblock, right=3cm of PHY,font=fontsize{12}{0}selectfont]. In your answer, all the node distance keys have no effect because they are to be placed earlier. That is, remove all node distance statements and put the distance in the below of and so on keys.

    – marmot
    23 hours ago











  • Ok fixed... Didn't realized what you said at first time and thought that I have to study things to make the requested edit and know what I am doing. But what you said was simple and thus, edited the question. thanks

    – koleygr
    22 hours ago














3












3








3







How about



documentclass[tikz,border=3.14mm]{standalone}

usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
begin{tikzpicture}
begin{axis}[
xmode=log,
xlabel={Frequency (Hz)},
ylabel={Gain (db)},
xmin=0, xmax=20000,
ymin=-30, ymax=10,
xtick={0,100,1000,10000},
ytick={10,0,-10,-20,-30},
legend pos=north west,
ymajorgrids=true,
grid style=dashed,
legend pos=north east
]

addplot[
color=blue,
mark=square,
only marks,
]
coordinates {
(100,-0.18)(1000,-8.5)(2000,-14.15)(4000,-19.83)(10000,-27.79)
};
addlegendentry{data}

addplot[color=orange,no marks] coordinates {(1000,-8.5) (10000,-27.79)};
addlegendentry{fit}
end{axis}
end{tikzpicture}
end{document}


enter image description here






share|improve this answer













How about



documentclass[tikz,border=3.14mm]{standalone}

usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
begin{tikzpicture}
begin{axis}[
xmode=log,
xlabel={Frequency (Hz)},
ylabel={Gain (db)},
xmin=0, xmax=20000,
ymin=-30, ymax=10,
xtick={0,100,1000,10000},
ytick={10,0,-10,-20,-30},
legend pos=north west,
ymajorgrids=true,
grid style=dashed,
legend pos=north east
]

addplot[
color=blue,
mark=square,
only marks,
]
coordinates {
(100,-0.18)(1000,-8.5)(2000,-14.15)(4000,-19.83)(10000,-27.79)
};
addlegendentry{data}

addplot[color=orange,no marks] coordinates {(1000,-8.5) (10000,-27.79)};
addlegendentry{fit}
end{axis}
end{tikzpicture}
end{document}


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered 23 hours ago









marmotmarmot

106k4127241




106k4127241













  • I think (s)he wants the equation in the legend. (Already provided in his question I think -but didn't solved- See his comment on my deleted answer)

    – koleygr
    23 hours ago








  • 1





    @koleygr Thanks! One can replace addlegendentry{fit} by addlegendentry{$E=mc^2$}, say, to get an equation. Please consider changing your answer tex.stackexchange.com/a/477600/121799. You need only something like node [whtblock, right=3cm of PHY,font=fontsize{12}{0}selectfont]. In your answer, all the node distance keys have no effect because they are to be placed earlier. That is, remove all node distance statements and put the distance in the below of and so on keys.

    – marmot
    23 hours ago











  • Ok fixed... Didn't realized what you said at first time and thought that I have to study things to make the requested edit and know what I am doing. But what you said was simple and thus, edited the question. thanks

    – koleygr
    22 hours ago



















  • I think (s)he wants the equation in the legend. (Already provided in his question I think -but didn't solved- See his comment on my deleted answer)

    – koleygr
    23 hours ago








  • 1





    @koleygr Thanks! One can replace addlegendentry{fit} by addlegendentry{$E=mc^2$}, say, to get an equation. Please consider changing your answer tex.stackexchange.com/a/477600/121799. You need only something like node [whtblock, right=3cm of PHY,font=fontsize{12}{0}selectfont]. In your answer, all the node distance keys have no effect because they are to be placed earlier. That is, remove all node distance statements and put the distance in the below of and so on keys.

    – marmot
    23 hours ago











  • Ok fixed... Didn't realized what you said at first time and thought that I have to study things to make the requested edit and know what I am doing. But what you said was simple and thus, edited the question. thanks

    – koleygr
    22 hours ago

















I think (s)he wants the equation in the legend. (Already provided in his question I think -but didn't solved- See his comment on my deleted answer)

– koleygr
23 hours ago







I think (s)he wants the equation in the legend. (Already provided in his question I think -but didn't solved- See his comment on my deleted answer)

– koleygr
23 hours ago






1




1





@koleygr Thanks! One can replace addlegendentry{fit} by addlegendentry{$E=mc^2$}, say, to get an equation. Please consider changing your answer tex.stackexchange.com/a/477600/121799. You need only something like node [whtblock, right=3cm of PHY,font=fontsize{12}{0}selectfont]. In your answer, all the node distance keys have no effect because they are to be placed earlier. That is, remove all node distance statements and put the distance in the below of and so on keys.

– marmot
23 hours ago





@koleygr Thanks! One can replace addlegendentry{fit} by addlegendentry{$E=mc^2$}, say, to get an equation. Please consider changing your answer tex.stackexchange.com/a/477600/121799. You need only something like node [whtblock, right=3cm of PHY,font=fontsize{12}{0}selectfont]. In your answer, all the node distance keys have no effect because they are to be placed earlier. That is, remove all node distance statements and put the distance in the below of and so on keys.

– marmot
23 hours ago













Ok fixed... Didn't realized what you said at first time and thought that I have to study things to make the requested edit and know what I am doing. But what you said was simple and thus, edited the question. thanks

– koleygr
22 hours ago





Ok fixed... Didn't realized what you said at first time and thought that I have to study things to make the requested edit and know what I am doing. But what you said was simple and thus, edited the question. thanks

– koleygr
22 hours ago










Tom Finet is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Tom Finet is a new contributor. Be nice, and check out our Code of Conduct.













Tom Finet is a new contributor. Be nice, and check out our Code of Conduct.












Tom Finet is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f477748%2fhow-to-add-line-connecting-two-coordinates-on-a-graph-with-logarithmic-x-axis-sc%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Why does my Macbook overheat and use so much CPU and energy when on YouTube?Why do so many insist on using...

How to prevent page numbers from appearing on glossaries?How to remove a dot and a page number in the...

Puerta de Hutt Referencias Enlaces externos Menú de navegación15°58′00″S 5°42′00″O /...