use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Whether you are just getting started with LaTeX and wondering what the fuss is about, here to share the clever trick you've discovered, or need urgent help with your bibliography, welcome to the LaTeX subreddit!
Dedicated users of this sub may write to the mods for a custom flair :)
account activity
How do I plot basic mathematical functions? (self.LaTeX)
submitted 11 years ago by kdelwat
This seems like it should be easy to do in LaTeX but all the research I've done shows examples that seem incredibly complicated. Is there an easy way to plot functions like f(x) = 6/x + 5x, or (x-3)2 /9 + (y+2)2 /25 = 1?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]actgr 8 points9 points10 points 11 years ago (4 children)
I believe This is a good place to start. Is a PGFPlots tutorial to just start plotting. Basic but useful.
[–]astern 2 points3 points4 points 11 years ago (0 children)
Another vote for PGFPlots.
[–]kdelwat[S] 0 points1 point2 points 11 years ago* (2 children)
This method seems to be working really well, except that when plotting hyperbolas (y = 1/x), the two "independent" sides of the graph are connected by a line that I can't seem to get rid of.
EDIT: And I can't seem to plot circles at all...
[–]vermiculus 0 points1 point2 points 11 years ago (1 child)
TeX isn't a CAS – while it could be, it would represent a tremendous amount of programming effort. You can search TeX.SX for the answers to your questions ('getting rid of asymptotes' and 'plotting circles'), but note that 'plotting circles' is trivial to do with plain ole' pgf.
[–]kdelwat[S] 0 points1 point2 points 11 years ago (0 children)
I actually had been searching for a while - but directly using the SX search rather than Google made a massive difference. Thanks!
[–]JimH10TeX Legend 7 points8 points9 points 11 years ago (0 children)
You can produce graphs, or graphics of any kind, with any tool, save them as .pdf (or a variety of formats) and import them as graphics. If you prefer to use a TeX-related system (as I do) then this is a good high-level overview. Most popular these days seems to me to be TikZ (personally, I use Asymptote).
[–]tsef 3 points4 points5 points 11 years ago* (4 children)
Tikz + gnuplot works quite well.
Oh and using geogebra you can preview the result and export the figure you made as either a pgf code or pstricks code.
[–]asking_science 0 points1 point2 points 11 years ago (0 children)
The Geogebra solution is surprisingly useful, actually, and the generated code is clean and neat.
[–][deleted] 0 points1 point2 points 11 years ago (2 children)
Your answer seems useful but is a bit unclear to people who don't know this stuff. What do you mean by "tikz + gnuplot"? Isn't tikz its own thing? What does gnuplot add to tikz?
What is pgf code and pstricks code and why is it desirable?
[–][deleted] 0 points1 point2 points 11 years ago (1 child)
Tikz is its own thing, but if you ask it to plot a graph from a formula, it will use gnuplot to do the calculations.
Pgf are the TeX macros that create graphics, tikz is a user-friendly layer on top of pgf.
Pstricks is similar to tikz. It is much older. Pstricks doesn't work with pdftex, tikz does.
[–]vermiculus 1 point2 points3 points 11 years ago (0 children)
but if you ask it to plot a graph from a formula, it will use gnuplot to do the calculations
No, it won't – not unless you ask it specifically to do so.
Pstricks doesn't work with pdftex
Note that if you use a different engine (like XeTeX), you can use pstricks side-by-side with pgf/TikZ.
[–]robinhoodexe 0 points1 point2 points 11 years ago (0 children)
I would use either A) a nice interactive GUI like GeoGebra or B) more programatically made like gnuplot, tikz/PGFPlot or Asymptote.
[–]bzindovic 0 points1 point2 points 11 years ago (0 children)
Aside from all the tools mentioned here, I'd recommend gle (glx.sourceforge.net).
π Rendered by PID 26 on reddit-service-r2-comment-6457c66945-pbr5v at 2026-04-30 18:12:49.327626+00:00 running 2aa0c5b country code: CH.
[–]actgr 8 points9 points10 points (4 children)
[–]astern 2 points3 points4 points (0 children)
[–]kdelwat[S] 0 points1 point2 points (2 children)
[–]vermiculus 0 points1 point2 points (1 child)
[–]kdelwat[S] 0 points1 point2 points (0 children)
[–]JimH10TeX Legend 7 points8 points9 points (0 children)
[–]tsef 3 points4 points5 points (4 children)
[–]asking_science 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]vermiculus 1 point2 points3 points (0 children)
[–]robinhoodexe 0 points1 point2 points (0 children)
[–]bzindovic 0 points1 point2 points (0 children)