My goal is to be able to generate, on-the-fly, a small variety of graphs--linear functions, quadratics, inequalities, multiple plots of each. Nothing more complex than what you'd see in a high school Algebra I course. I'd also like to be able to shade the graphs of inequalities. Let me know if I should open different questions for each type of function.
Let's start this question with how to graph y = 2x + 1 and convert to PNG. I don't need much detail in the graph--labeled axes, number markings and the function. A background grid would be a bonus.
I'd also like to convert to PNG images. Right now, the closest process I have is text (Let me be clear, I need graphs) in TeXWorks (Windows) generating a {standalone} PDF that I have to ultimately convert using the ImageMagick convert command.
\documentclass[preview]{standalone}
\begin{document}
Hello, World!
y = 2x + 1
\end{document}
I select pdfLaTeX and this generates a PDF. I follow this with the ImageMagick conversion:
convert myfile.pdf myimage.png
This process does work, but it's clunky. These images will be used in a web application, so is generating them on the fly with all this file I/O really the best way?
tex2png
I've tried tex2png but it hangs on the PostScript File Generation... step.
e:\downloads\tex2png>tex2png "\sum_{i=1}^N{i}=\frac{N(N+1)}{2}" result.png
[>] LaTeX File Generation...
[>] LaTeX File Compilation...
[>] PostScript File Generation...


pgfplotscomes to my mind immediately. – hakaze Nov 13 '12 at 13:47