Drawing from a specific x-axis value to a line intersection then to y-axis
Using the following code, how to automate the process of drawing from a specific x-axis point up to the intersection to a line, then to the y-axis.
documentclass{beamer}
beamertemplatenavigationsymbolsempty
usepackage{verbatim}
usepackage{tikz}
usepackage{pgfplots}
begin{document}
begin{frame}[fragile,t]
frametitle{}
begin{tikzpicture}[scale=.8, transform shape]
pgfmathsetmacro{incrmnty}{1.}
pgfmathsetmacro{incrmntx}{2.}
pgfmathsetmacro{xlab}{2006}
pgfmathsetmacro{xn}{5}
pgfmathsetmacro{yn}{5}
begin{scope}[xshift=0cm, yshift=0cm]
draw [thick](0,0) -- (incrmntx*xn+2,0);
node at (incrmntx*xn+2,incrmnty*yn-.4) (endx){};% to compensate for the shift of the x-axis labels, and to draw short from the end of the y-axis
draw [thick](0,0) -- (0,incrmnty*yn);
end{scope}
begin{scope}[xshift=incrmntx*.4cm, yshift=0cm]% to shift the x-axis labels
foreach x [evaluate=x as aff using int(xlab+(1*x))]in {0,...,xn}{draw [black!20!white] (incrmntx*x,0) node [black, xshift=0cm, yshift=-.68cm] {footnotesize aff} -- +(-90:.2);}
end{scope}
draw[blue!40!black, line width=.4mm] (-.1*incrmntx,1.56*incrmnty) -- (endx.center);
draw[blue!80!white, thick, dashed] (incrmntx*xn+.8,0) --+(90:4.26cm) node (aa){} -| (aa.center-|0,0) node [black, xshift=-1cm, yshift=.06cm] {2011 value};
draw[red!40!black, line width=.4mm] (-.1*incrmntx,2.5*incrmnty) -- (endx.center);
draw[red!80!white, thick, dashed] (incrmntx*xn-3.2,0) --+(90:3.7cm) node (bb){} -| (bb.center-|0,0) node [black, xshift=-1cm, yshift=.06cm] {2009 value};
end{tikzpicture}
end{frame}
end{document}
tikz-pgf
add a comment |
Using the following code, how to automate the process of drawing from a specific x-axis point up to the intersection to a line, then to the y-axis.
documentclass{beamer}
beamertemplatenavigationsymbolsempty
usepackage{verbatim}
usepackage{tikz}
usepackage{pgfplots}
begin{document}
begin{frame}[fragile,t]
frametitle{}
begin{tikzpicture}[scale=.8, transform shape]
pgfmathsetmacro{incrmnty}{1.}
pgfmathsetmacro{incrmntx}{2.}
pgfmathsetmacro{xlab}{2006}
pgfmathsetmacro{xn}{5}
pgfmathsetmacro{yn}{5}
begin{scope}[xshift=0cm, yshift=0cm]
draw [thick](0,0) -- (incrmntx*xn+2,0);
node at (incrmntx*xn+2,incrmnty*yn-.4) (endx){};% to compensate for the shift of the x-axis labels, and to draw short from the end of the y-axis
draw [thick](0,0) -- (0,incrmnty*yn);
end{scope}
begin{scope}[xshift=incrmntx*.4cm, yshift=0cm]% to shift the x-axis labels
foreach x [evaluate=x as aff using int(xlab+(1*x))]in {0,...,xn}{draw [black!20!white] (incrmntx*x,0) node [black, xshift=0cm, yshift=-.68cm] {footnotesize aff} -- +(-90:.2);}
end{scope}
draw[blue!40!black, line width=.4mm] (-.1*incrmntx,1.56*incrmnty) -- (endx.center);
draw[blue!80!white, thick, dashed] (incrmntx*xn+.8,0) --+(90:4.26cm) node (aa){} -| (aa.center-|0,0) node [black, xshift=-1cm, yshift=.06cm] {2011 value};
draw[red!40!black, line width=.4mm] (-.1*incrmntx,2.5*incrmnty) -- (endx.center);
draw[red!80!white, thick, dashed] (incrmntx*xn-3.2,0) --+(90:3.7cm) node (bb){} -| (bb.center-|0,0) node [black, xshift=-1cm, yshift=.06cm] {2009 value};
end{tikzpicture}
end{frame}
end{document}
tikz-pgf
add a comment |
Using the following code, how to automate the process of drawing from a specific x-axis point up to the intersection to a line, then to the y-axis.
documentclass{beamer}
beamertemplatenavigationsymbolsempty
usepackage{verbatim}
usepackage{tikz}
usepackage{pgfplots}
begin{document}
begin{frame}[fragile,t]
frametitle{}
begin{tikzpicture}[scale=.8, transform shape]
pgfmathsetmacro{incrmnty}{1.}
pgfmathsetmacro{incrmntx}{2.}
pgfmathsetmacro{xlab}{2006}
pgfmathsetmacro{xn}{5}
pgfmathsetmacro{yn}{5}
begin{scope}[xshift=0cm, yshift=0cm]
draw [thick](0,0) -- (incrmntx*xn+2,0);
node at (incrmntx*xn+2,incrmnty*yn-.4) (endx){};% to compensate for the shift of the x-axis labels, and to draw short from the end of the y-axis
draw [thick](0,0) -- (0,incrmnty*yn);
end{scope}
begin{scope}[xshift=incrmntx*.4cm, yshift=0cm]% to shift the x-axis labels
foreach x [evaluate=x as aff using int(xlab+(1*x))]in {0,...,xn}{draw [black!20!white] (incrmntx*x,0) node [black, xshift=0cm, yshift=-.68cm] {footnotesize aff} -- +(-90:.2);}
end{scope}
draw[blue!40!black, line width=.4mm] (-.1*incrmntx,1.56*incrmnty) -- (endx.center);
draw[blue!80!white, thick, dashed] (incrmntx*xn+.8,0) --+(90:4.26cm) node (aa){} -| (aa.center-|0,0) node [black, xshift=-1cm, yshift=.06cm] {2011 value};
draw[red!40!black, line width=.4mm] (-.1*incrmntx,2.5*incrmnty) -- (endx.center);
draw[red!80!white, thick, dashed] (incrmntx*xn-3.2,0) --+(90:3.7cm) node (bb){} -| (bb.center-|0,0) node [black, xshift=-1cm, yshift=.06cm] {2009 value};
end{tikzpicture}
end{frame}
end{document}
tikz-pgf
Using the following code, how to automate the process of drawing from a specific x-axis point up to the intersection to a line, then to the y-axis.
documentclass{beamer}
beamertemplatenavigationsymbolsempty
usepackage{verbatim}
usepackage{tikz}
usepackage{pgfplots}
begin{document}
begin{frame}[fragile,t]
frametitle{}
begin{tikzpicture}[scale=.8, transform shape]
pgfmathsetmacro{incrmnty}{1.}
pgfmathsetmacro{incrmntx}{2.}
pgfmathsetmacro{xlab}{2006}
pgfmathsetmacro{xn}{5}
pgfmathsetmacro{yn}{5}
begin{scope}[xshift=0cm, yshift=0cm]
draw [thick](0,0) -- (incrmntx*xn+2,0);
node at (incrmntx*xn+2,incrmnty*yn-.4) (endx){};% to compensate for the shift of the x-axis labels, and to draw short from the end of the y-axis
draw [thick](0,0) -- (0,incrmnty*yn);
end{scope}
begin{scope}[xshift=incrmntx*.4cm, yshift=0cm]% to shift the x-axis labels
foreach x [evaluate=x as aff using int(xlab+(1*x))]in {0,...,xn}{draw [black!20!white] (incrmntx*x,0) node [black, xshift=0cm, yshift=-.68cm] {footnotesize aff} -- +(-90:.2);}
end{scope}
draw[blue!40!black, line width=.4mm] (-.1*incrmntx,1.56*incrmnty) -- (endx.center);
draw[blue!80!white, thick, dashed] (incrmntx*xn+.8,0) --+(90:4.26cm) node (aa){} -| (aa.center-|0,0) node [black, xshift=-1cm, yshift=.06cm] {2011 value};
draw[red!40!black, line width=.4mm] (-.1*incrmntx,2.5*incrmnty) -- (endx.center);
draw[red!80!white, thick, dashed] (incrmntx*xn-3.2,0) --+(90:3.7cm) node (bb){} -| (bb.center-|0,0) node [black, xshift=-1cm, yshift=.06cm] {2009 value};
end{tikzpicture}
end{frame}
end{document}
tikz-pgf
tikz-pgf
asked 3 mins ago
HanyHany
1,238416
1,238416
add a comment |
add a comment |
0
active
oldest
votes
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
});
}
});
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%2ftex.stackexchange.com%2fquestions%2f476096%2fdrawing-from-a-specific-x-axis-value-to-a-line-intersection-then-to-y-axis%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
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%2ftex.stackexchange.com%2fquestions%2f476096%2fdrawing-from-a-specific-x-axis-value-to-a-line-intersection-then-to-y-axis%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