Help! How to draw the plot of y=(ax+b)/(cx+d) and give an example!











up vote
6
down vote

favorite












I find in pst-plot.pdf, pst-func.pdf document but there is no its tutorial. So I hope anyone help me to draw the plot of it.(its code :-)) ). Thanks.



Example:
y=(x-2)/(2x+1)



enter image description here



Can anyone draw it by Pstricks environment?










share|improve this question




















  • 2




    Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with documentclass{...} and ending with end{document}. Note this is a Q&A site, not a please do this for me service. What do you have so far.
    – albert
    2 days ago










  • Sorry, i don't know its code so i hope anyone know about it to help me.
    – Trong Vuong
    2 days ago










  • Vietnamese TikZ tutorial: Link
    – Dũng Vũ
    2 days ago










  • There is no the plot of functions y=(ax+b)/(cx+d). :))
    – Trong Vuong
    2 days ago















up vote
6
down vote

favorite












I find in pst-plot.pdf, pst-func.pdf document but there is no its tutorial. So I hope anyone help me to draw the plot of it.(its code :-)) ). Thanks.



Example:
y=(x-2)/(2x+1)



enter image description here



Can anyone draw it by Pstricks environment?










share|improve this question




















  • 2




    Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with documentclass{...} and ending with end{document}. Note this is a Q&A site, not a please do this for me service. What do you have so far.
    – albert
    2 days ago










  • Sorry, i don't know its code so i hope anyone know about it to help me.
    – Trong Vuong
    2 days ago










  • Vietnamese TikZ tutorial: Link
    – Dũng Vũ
    2 days ago










  • There is no the plot of functions y=(ax+b)/(cx+d). :))
    – Trong Vuong
    2 days ago













up vote
6
down vote

favorite









up vote
6
down vote

favorite











I find in pst-plot.pdf, pst-func.pdf document but there is no its tutorial. So I hope anyone help me to draw the plot of it.(its code :-)) ). Thanks.



Example:
y=(x-2)/(2x+1)



enter image description here



Can anyone draw it by Pstricks environment?










share|improve this question















I find in pst-plot.pdf, pst-func.pdf document but there is no its tutorial. So I hope anyone help me to draw the plot of it.(its code :-)) ). Thanks.



Example:
y=(x-2)/(2x+1)



enter image description here



Can anyone draw it by Pstricks environment?







tikz-pgf pstricks plot pst-plot






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago









Artificial Stupidity

4,4121832




4,4121832










asked 2 days ago









Trong Vuong

1628




1628








  • 2




    Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with documentclass{...} and ending with end{document}. Note this is a Q&A site, not a please do this for me service. What do you have so far.
    – albert
    2 days ago










  • Sorry, i don't know its code so i hope anyone know about it to help me.
    – Trong Vuong
    2 days ago










  • Vietnamese TikZ tutorial: Link
    – Dũng Vũ
    2 days ago










  • There is no the plot of functions y=(ax+b)/(cx+d). :))
    – Trong Vuong
    2 days ago














  • 2




    Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with documentclass{...} and ending with end{document}. Note this is a Q&A site, not a please do this for me service. What do you have so far.
    – albert
    2 days ago










  • Sorry, i don't know its code so i hope anyone know about it to help me.
    – Trong Vuong
    2 days ago










  • Vietnamese TikZ tutorial: Link
    – Dũng Vũ
    2 days ago










  • There is no the plot of functions y=(ax+b)/(cx+d). :))
    – Trong Vuong
    2 days ago








2




2




Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with documentclass{...} and ending with end{document}. Note this is a Q&A site, not a please do this for me service. What do you have so far.
– albert
2 days ago




Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with documentclass{...} and ending with end{document}. Note this is a Q&A site, not a please do this for me service. What do you have so far.
– albert
2 days ago












Sorry, i don't know its code so i hope anyone know about it to help me.
– Trong Vuong
2 days ago




Sorry, i don't know its code so i hope anyone know about it to help me.
– Trong Vuong
2 days ago












Vietnamese TikZ tutorial: Link
– Dũng Vũ
2 days ago




Vietnamese TikZ tutorial: Link
– Dũng Vũ
2 days ago












There is no the plot of functions y=(ax+b)/(cx+d). :))
– Trong Vuong
2 days ago




There is no the plot of functions y=(ax+b)/(cx+d). :))
– Trong Vuong
2 days ago










3 Answers
3






active

oldest

votes

















up vote
15
down vote



accepted










documentclass{article}


usepackage{pgfplots}



begin{document}

begin{center}
begin{tikzpicture}[scale=2]
begin{axis}[axis lines=middle]
addplot[smooth,domain=-4:-8/11,purple,very thick] {(x-2)/(2*x+1)};
addplot[smooth,domain=-2/7:4,purple,very thick] {(x-2)/(2*x+1)};
draw[blue] (axis cs:-0.5,-6)--(axis cs:-0.5,6)
(axis cs:-4,0.5)--(axis cs:4,0.5);
fill[red] (axis cs:-0.5,0.5) circle(1mm);
end{axis}
end{tikzpicture}
end{center}
end{document}


enter image description here






share|improve this answer

















  • 1




    Thank you for your answer.
    – Trong Vuong
    2 days ago






  • 2




    @TrongVuong If you agree with this answer, then you accept it and vote for answer.
    – minhthien_2016
    2 days ago




















up vote
7
down vote













documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}

begin{document}
begin{pspicture}[algebraic](-6,-6)(6,6)
psaxes{->}(0,0)(-5.5,-5.5)(5.5,5.5)[$x$,0][$y$,90]
psline[linecolor=red,linewidth=0.2pt](-0.5,-5.5)(-0.5,5.5)
psline[linecolor=red,linewidth=0.2pt](-5.5,0.5)(5.5,0.5)
psplot[plotpoints=1001,linecolor=blue,linewidth=2pt,
yMaxValue=5.25]{-5.5}{5}{(x-2)/(2*x+1)}
psdots[linecolor=red](-0.5,0.5)(0,0)(0,-2)(1,0)(2,0)
end{pspicture}
end{document}


enter image description here






share|improve this answer





















  • Good answer. Thanks
    – Trong Vuong
    2 days ago


















up vote
7
down vote













A PSTricks answer for the PSTricks question.



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff{(x-2)/(2*x+1)}

begin{document}
begin{pspicture}[algebraic](-4,-4)(6,5.5)
psaxes{->}(0,0)(-4,-4)(5.5,5)[$x$,0][$y$,90]
psline[linestyle=dashed,linecolor=red](-0.5,-4)(-0.5,5)
psline[linestyle=dashed,linecolor=red](-4,0.5)(5,0.5)
psset{linecolor=blue,linewidth=2pt}
psplot{-4}{-7 9 div}{f}
psplot{-2 9 div}{5}{f}
end{pspicture}
end{document}


enter image description here



NOTE



Increasing plotpoints sometimes is not a wise method because it will increase the size of its output (either PDF or SVG).



More flexible solution



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff(#1){((#1-2)/(2*(#1)+1))}% y=f(x)
defg(#1){((2+#1)/(1-2*(#1)))}% y=g(x) in which g is the inverse of f.

pstVerb{/I2P {AlgParser cvx exec} def}% infix to postfix operator

begin{document}
begin{pspicture}[algebraic](-4,-4)(6,6)
psaxes{->}(0,0)(-4,-4)(5.5,5.5)[$x$,0][$y$,90]
psline[linestyle=dashed,linecolor=red](-0.5,-4)(-0.5,5)
psline[linestyle=dashed,linecolor=red](-4,0.5)(5,0.5)
psset{linecolor=blue,linewidth=2pt}
psplot{-4}{g(5) I2P}{f(x)}
psplot{g(-4) I2P}{5}{f(x)}
end{pspicture}
end{document}





share|improve this answer























  • Thank you bro.:))
    – Trong Vuong
    2 days ago






  • 1




    Hey guy! In JPi's answer, the plot of function overlay x-axes and y-axes at y=6,x=4. Can you fix your code at y=5,y=-4?
    – Trong Vuong
    yesterday










  • Big thanks. :-))
    – Trong Vuong
    yesterday











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',
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
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460456%2fhelp-how-to-draw-the-plot-of-y-axb-cxd-and-give-an-example%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
15
down vote



accepted










documentclass{article}


usepackage{pgfplots}



begin{document}

begin{center}
begin{tikzpicture}[scale=2]
begin{axis}[axis lines=middle]
addplot[smooth,domain=-4:-8/11,purple,very thick] {(x-2)/(2*x+1)};
addplot[smooth,domain=-2/7:4,purple,very thick] {(x-2)/(2*x+1)};
draw[blue] (axis cs:-0.5,-6)--(axis cs:-0.5,6)
(axis cs:-4,0.5)--(axis cs:4,0.5);
fill[red] (axis cs:-0.5,0.5) circle(1mm);
end{axis}
end{tikzpicture}
end{center}
end{document}


enter image description here






share|improve this answer

















  • 1




    Thank you for your answer.
    – Trong Vuong
    2 days ago






  • 2




    @TrongVuong If you agree with this answer, then you accept it and vote for answer.
    – minhthien_2016
    2 days ago

















up vote
15
down vote



accepted










documentclass{article}


usepackage{pgfplots}



begin{document}

begin{center}
begin{tikzpicture}[scale=2]
begin{axis}[axis lines=middle]
addplot[smooth,domain=-4:-8/11,purple,very thick] {(x-2)/(2*x+1)};
addplot[smooth,domain=-2/7:4,purple,very thick] {(x-2)/(2*x+1)};
draw[blue] (axis cs:-0.5,-6)--(axis cs:-0.5,6)
(axis cs:-4,0.5)--(axis cs:4,0.5);
fill[red] (axis cs:-0.5,0.5) circle(1mm);
end{axis}
end{tikzpicture}
end{center}
end{document}


enter image description here






share|improve this answer

















  • 1




    Thank you for your answer.
    – Trong Vuong
    2 days ago






  • 2




    @TrongVuong If you agree with this answer, then you accept it and vote for answer.
    – minhthien_2016
    2 days ago















up vote
15
down vote



accepted







up vote
15
down vote



accepted






documentclass{article}


usepackage{pgfplots}



begin{document}

begin{center}
begin{tikzpicture}[scale=2]
begin{axis}[axis lines=middle]
addplot[smooth,domain=-4:-8/11,purple,very thick] {(x-2)/(2*x+1)};
addplot[smooth,domain=-2/7:4,purple,very thick] {(x-2)/(2*x+1)};
draw[blue] (axis cs:-0.5,-6)--(axis cs:-0.5,6)
(axis cs:-4,0.5)--(axis cs:4,0.5);
fill[red] (axis cs:-0.5,0.5) circle(1mm);
end{axis}
end{tikzpicture}
end{center}
end{document}


enter image description here






share|improve this answer












documentclass{article}


usepackage{pgfplots}



begin{document}

begin{center}
begin{tikzpicture}[scale=2]
begin{axis}[axis lines=middle]
addplot[smooth,domain=-4:-8/11,purple,very thick] {(x-2)/(2*x+1)};
addplot[smooth,domain=-2/7:4,purple,very thick] {(x-2)/(2*x+1)};
draw[blue] (axis cs:-0.5,-6)--(axis cs:-0.5,6)
(axis cs:-4,0.5)--(axis cs:4,0.5);
fill[red] (axis cs:-0.5,0.5) circle(1mm);
end{axis}
end{tikzpicture}
end{center}
end{document}


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered 2 days ago









JPi

9,43921448




9,43921448








  • 1




    Thank you for your answer.
    – Trong Vuong
    2 days ago






  • 2




    @TrongVuong If you agree with this answer, then you accept it and vote for answer.
    – minhthien_2016
    2 days ago
















  • 1




    Thank you for your answer.
    – Trong Vuong
    2 days ago






  • 2




    @TrongVuong If you agree with this answer, then you accept it and vote for answer.
    – minhthien_2016
    2 days ago










1




1




Thank you for your answer.
– Trong Vuong
2 days ago




Thank you for your answer.
– Trong Vuong
2 days ago




2




2




@TrongVuong If you agree with this answer, then you accept it and vote for answer.
– minhthien_2016
2 days ago






@TrongVuong If you agree with this answer, then you accept it and vote for answer.
– minhthien_2016
2 days ago












up vote
7
down vote













documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}

begin{document}
begin{pspicture}[algebraic](-6,-6)(6,6)
psaxes{->}(0,0)(-5.5,-5.5)(5.5,5.5)[$x$,0][$y$,90]
psline[linecolor=red,linewidth=0.2pt](-0.5,-5.5)(-0.5,5.5)
psline[linecolor=red,linewidth=0.2pt](-5.5,0.5)(5.5,0.5)
psplot[plotpoints=1001,linecolor=blue,linewidth=2pt,
yMaxValue=5.25]{-5.5}{5}{(x-2)/(2*x+1)}
psdots[linecolor=red](-0.5,0.5)(0,0)(0,-2)(1,0)(2,0)
end{pspicture}
end{document}


enter image description here






share|improve this answer





















  • Good answer. Thanks
    – Trong Vuong
    2 days ago















up vote
7
down vote













documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}

begin{document}
begin{pspicture}[algebraic](-6,-6)(6,6)
psaxes{->}(0,0)(-5.5,-5.5)(5.5,5.5)[$x$,0][$y$,90]
psline[linecolor=red,linewidth=0.2pt](-0.5,-5.5)(-0.5,5.5)
psline[linecolor=red,linewidth=0.2pt](-5.5,0.5)(5.5,0.5)
psplot[plotpoints=1001,linecolor=blue,linewidth=2pt,
yMaxValue=5.25]{-5.5}{5}{(x-2)/(2*x+1)}
psdots[linecolor=red](-0.5,0.5)(0,0)(0,-2)(1,0)(2,0)
end{pspicture}
end{document}


enter image description here






share|improve this answer





















  • Good answer. Thanks
    – Trong Vuong
    2 days ago













up vote
7
down vote










up vote
7
down vote









documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}

begin{document}
begin{pspicture}[algebraic](-6,-6)(6,6)
psaxes{->}(0,0)(-5.5,-5.5)(5.5,5.5)[$x$,0][$y$,90]
psline[linecolor=red,linewidth=0.2pt](-0.5,-5.5)(-0.5,5.5)
psline[linecolor=red,linewidth=0.2pt](-5.5,0.5)(5.5,0.5)
psplot[plotpoints=1001,linecolor=blue,linewidth=2pt,
yMaxValue=5.25]{-5.5}{5}{(x-2)/(2*x+1)}
psdots[linecolor=red](-0.5,0.5)(0,0)(0,-2)(1,0)(2,0)
end{pspicture}
end{document}


enter image description here






share|improve this answer












documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}

begin{document}
begin{pspicture}[algebraic](-6,-6)(6,6)
psaxes{->}(0,0)(-5.5,-5.5)(5.5,5.5)[$x$,0][$y$,90]
psline[linecolor=red,linewidth=0.2pt](-0.5,-5.5)(-0.5,5.5)
psline[linecolor=red,linewidth=0.2pt](-5.5,0.5)(5.5,0.5)
psplot[plotpoints=1001,linecolor=blue,linewidth=2pt,
yMaxValue=5.25]{-5.5}{5}{(x-2)/(2*x+1)}
psdots[linecolor=red](-0.5,0.5)(0,0)(0,-2)(1,0)(2,0)
end{pspicture}
end{document}


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered 2 days ago









Herbert

265k23401712




265k23401712












  • Good answer. Thanks
    – Trong Vuong
    2 days ago


















  • Good answer. Thanks
    – Trong Vuong
    2 days ago
















Good answer. Thanks
– Trong Vuong
2 days ago




Good answer. Thanks
– Trong Vuong
2 days ago










up vote
7
down vote













A PSTricks answer for the PSTricks question.



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff{(x-2)/(2*x+1)}

begin{document}
begin{pspicture}[algebraic](-4,-4)(6,5.5)
psaxes{->}(0,0)(-4,-4)(5.5,5)[$x$,0][$y$,90]
psline[linestyle=dashed,linecolor=red](-0.5,-4)(-0.5,5)
psline[linestyle=dashed,linecolor=red](-4,0.5)(5,0.5)
psset{linecolor=blue,linewidth=2pt}
psplot{-4}{-7 9 div}{f}
psplot{-2 9 div}{5}{f}
end{pspicture}
end{document}


enter image description here



NOTE



Increasing plotpoints sometimes is not a wise method because it will increase the size of its output (either PDF or SVG).



More flexible solution



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff(#1){((#1-2)/(2*(#1)+1))}% y=f(x)
defg(#1){((2+#1)/(1-2*(#1)))}% y=g(x) in which g is the inverse of f.

pstVerb{/I2P {AlgParser cvx exec} def}% infix to postfix operator

begin{document}
begin{pspicture}[algebraic](-4,-4)(6,6)
psaxes{->}(0,0)(-4,-4)(5.5,5.5)[$x$,0][$y$,90]
psline[linestyle=dashed,linecolor=red](-0.5,-4)(-0.5,5)
psline[linestyle=dashed,linecolor=red](-4,0.5)(5,0.5)
psset{linecolor=blue,linewidth=2pt}
psplot{-4}{g(5) I2P}{f(x)}
psplot{g(-4) I2P}{5}{f(x)}
end{pspicture}
end{document}





share|improve this answer























  • Thank you bro.:))
    – Trong Vuong
    2 days ago






  • 1




    Hey guy! In JPi's answer, the plot of function overlay x-axes and y-axes at y=6,x=4. Can you fix your code at y=5,y=-4?
    – Trong Vuong
    yesterday










  • Big thanks. :-))
    – Trong Vuong
    yesterday















up vote
7
down vote













A PSTricks answer for the PSTricks question.



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff{(x-2)/(2*x+1)}

begin{document}
begin{pspicture}[algebraic](-4,-4)(6,5.5)
psaxes{->}(0,0)(-4,-4)(5.5,5)[$x$,0][$y$,90]
psline[linestyle=dashed,linecolor=red](-0.5,-4)(-0.5,5)
psline[linestyle=dashed,linecolor=red](-4,0.5)(5,0.5)
psset{linecolor=blue,linewidth=2pt}
psplot{-4}{-7 9 div}{f}
psplot{-2 9 div}{5}{f}
end{pspicture}
end{document}


enter image description here



NOTE



Increasing plotpoints sometimes is not a wise method because it will increase the size of its output (either PDF or SVG).



More flexible solution



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff(#1){((#1-2)/(2*(#1)+1))}% y=f(x)
defg(#1){((2+#1)/(1-2*(#1)))}% y=g(x) in which g is the inverse of f.

pstVerb{/I2P {AlgParser cvx exec} def}% infix to postfix operator

begin{document}
begin{pspicture}[algebraic](-4,-4)(6,6)
psaxes{->}(0,0)(-4,-4)(5.5,5.5)[$x$,0][$y$,90]
psline[linestyle=dashed,linecolor=red](-0.5,-4)(-0.5,5)
psline[linestyle=dashed,linecolor=red](-4,0.5)(5,0.5)
psset{linecolor=blue,linewidth=2pt}
psplot{-4}{g(5) I2P}{f(x)}
psplot{g(-4) I2P}{5}{f(x)}
end{pspicture}
end{document}





share|improve this answer























  • Thank you bro.:))
    – Trong Vuong
    2 days ago






  • 1




    Hey guy! In JPi's answer, the plot of function overlay x-axes and y-axes at y=6,x=4. Can you fix your code at y=5,y=-4?
    – Trong Vuong
    yesterday










  • Big thanks. :-))
    – Trong Vuong
    yesterday













up vote
7
down vote










up vote
7
down vote









A PSTricks answer for the PSTricks question.



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff{(x-2)/(2*x+1)}

begin{document}
begin{pspicture}[algebraic](-4,-4)(6,5.5)
psaxes{->}(0,0)(-4,-4)(5.5,5)[$x$,0][$y$,90]
psline[linestyle=dashed,linecolor=red](-0.5,-4)(-0.5,5)
psline[linestyle=dashed,linecolor=red](-4,0.5)(5,0.5)
psset{linecolor=blue,linewidth=2pt}
psplot{-4}{-7 9 div}{f}
psplot{-2 9 div}{5}{f}
end{pspicture}
end{document}


enter image description here



NOTE



Increasing plotpoints sometimes is not a wise method because it will increase the size of its output (either PDF or SVG).



More flexible solution



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff(#1){((#1-2)/(2*(#1)+1))}% y=f(x)
defg(#1){((2+#1)/(1-2*(#1)))}% y=g(x) in which g is the inverse of f.

pstVerb{/I2P {AlgParser cvx exec} def}% infix to postfix operator

begin{document}
begin{pspicture}[algebraic](-4,-4)(6,6)
psaxes{->}(0,0)(-4,-4)(5.5,5.5)[$x$,0][$y$,90]
psline[linestyle=dashed,linecolor=red](-0.5,-4)(-0.5,5)
psline[linestyle=dashed,linecolor=red](-4,0.5)(5,0.5)
psset{linecolor=blue,linewidth=2pt}
psplot{-4}{g(5) I2P}{f(x)}
psplot{g(-4) I2P}{5}{f(x)}
end{pspicture}
end{document}





share|improve this answer














A PSTricks answer for the PSTricks question.



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff{(x-2)/(2*x+1)}

begin{document}
begin{pspicture}[algebraic](-4,-4)(6,5.5)
psaxes{->}(0,0)(-4,-4)(5.5,5)[$x$,0][$y$,90]
psline[linestyle=dashed,linecolor=red](-0.5,-4)(-0.5,5)
psline[linestyle=dashed,linecolor=red](-4,0.5)(5,0.5)
psset{linecolor=blue,linewidth=2pt}
psplot{-4}{-7 9 div}{f}
psplot{-2 9 div}{5}{f}
end{pspicture}
end{document}


enter image description here



NOTE



Increasing plotpoints sometimes is not a wise method because it will increase the size of its output (either PDF or SVG).



More flexible solution



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff(#1){((#1-2)/(2*(#1)+1))}% y=f(x)
defg(#1){((2+#1)/(1-2*(#1)))}% y=g(x) in which g is the inverse of f.

pstVerb{/I2P {AlgParser cvx exec} def}% infix to postfix operator

begin{document}
begin{pspicture}[algebraic](-4,-4)(6,6)
psaxes{->}(0,0)(-4,-4)(5.5,5.5)[$x$,0][$y$,90]
psline[linestyle=dashed,linecolor=red](-0.5,-4)(-0.5,5)
psline[linestyle=dashed,linecolor=red](-4,0.5)(5,0.5)
psset{linecolor=blue,linewidth=2pt}
psplot{-4}{g(5) I2P}{f(x)}
psplot{g(-4) I2P}{5}{f(x)}
end{pspicture}
end{document}






share|improve this answer














share|improve this answer



share|improve this answer








edited yesterday

























answered 2 days ago









Artificial Stupidity

4,4121832




4,4121832












  • Thank you bro.:))
    – Trong Vuong
    2 days ago






  • 1




    Hey guy! In JPi's answer, the plot of function overlay x-axes and y-axes at y=6,x=4. Can you fix your code at y=5,y=-4?
    – Trong Vuong
    yesterday










  • Big thanks. :-))
    – Trong Vuong
    yesterday


















  • Thank you bro.:))
    – Trong Vuong
    2 days ago






  • 1




    Hey guy! In JPi's answer, the plot of function overlay x-axes and y-axes at y=6,x=4. Can you fix your code at y=5,y=-4?
    – Trong Vuong
    yesterday










  • Big thanks. :-))
    – Trong Vuong
    yesterday
















Thank you bro.:))
– Trong Vuong
2 days ago




Thank you bro.:))
– Trong Vuong
2 days ago




1




1




Hey guy! In JPi's answer, the plot of function overlay x-axes and y-axes at y=6,x=4. Can you fix your code at y=5,y=-4?
– Trong Vuong
yesterday




Hey guy! In JPi's answer, the plot of function overlay x-axes and y-axes at y=6,x=4. Can you fix your code at y=5,y=-4?
– Trong Vuong
yesterday












Big thanks. :-))
– Trong Vuong
yesterday




Big thanks. :-))
– Trong Vuong
yesterday


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460456%2fhelp-how-to-draw-the-plot-of-y-axb-cxd-and-give-an-example%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

Bundesstraße 106

Verónica Boquete

Ida-Boy-Ed-Garten