I'm preparing a document for which I need to make a variety of 2D graphs, generally plotting simple functions such as sin(x), sqrt(x), etc. I need to be able to label the graphs, choose the axes variables, and have multiple functions on one graph, but that's about all I need.
Given my needs, what is simplest way to do this? I'm using Mac OS X if that is important. Is there a good "graphing" program I should download to create the graphs, and then export them to PDF or PNG?
The simpler the better, provided I can accomplish the goals listed above. Any thoughts are welcome.
Thanks in advance.
Graphics, Figures & Tables ⇒ Best Practice for Graphs
NEW: TikZ book now 40% off at Amazon.com for a short time.
Best Practice for Graphs
Hm, it's not LaTeX specific, but I would recommend GeoGebra. It's a Java based program originally for geometry, but it can handle simple graphs as well and you have full control about the axes and can label everything. Export to PNG or JPG.
-
- Posts: 162
- Joined: Wed Jun 17, 2009 10:18 pm
Re: Best Practice for Graphs
Geogebra can also export as TikZ or PSTricks code that you can include in your document. It does a pretty good job with TikZ at least, though some you might want to make some adjustments to the code.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Best Practice for Graphs
Try pgfplots (based on PGF/TikZ) or pst-plot (based on PSTricks). It will give you full control over your graphs from inside your LaTeX code. No export necessary.
A short example with pgfplots. The output is attached.
Thorsten
A short example with pgfplots. The output is attached.
Code: Select all
\documentclass[11pt]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{pgfplots}
\pgfplotsset{
compat=newest,
xlabel near ticks,
ylabel near ticks
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel={$x$ / rad},
ylabel={$\sin(x)$},
samples=100
]
\addplot[blue,smooth] {sin(deg(x))};
\addlegendentry{Sine curve};
\end{axis}
\end{tikzpicture}
\end{document}
Thorsten
- Attachments
-
- qtmp.png (4.97 KiB) Viewed 4149 times
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10