PGFPlots Generator
This PGFPlots generator turns a plain-English description of a chart into pgfplots code. Describe a function, a set of data points or a plot type, and an AI model (OpenAI GPT-5) writes a complete LaTeX document with a commented tikzpicture and axis environment: line and function plots, bar charts, scatter plots, histograms and 3D surfaces, with the axis labels, ranges, legend and colours you asked for.
The Preview tab compiles the plot with a full TeX Live distribution on the Octree compile service, so you see the PDF before you export the .tex file. Because the chart is drawn by LaTeX, it uses your document font and stays sharp at any size, unlike an image pasted from a spreadsheet. The generator is free and needs no account; the code it writes is yours to edit, from tick labels to plot styles.
How to generate a pgfplots chart
- Describe the plot. Say what to draw: the function or data points, the plot type (line, bar, scatter, area, histogram or 3D surface), axis ranges, labels, legend and colours. Pasting a small table of numbers works too.
- Generate the code. Click Generate Plot. The AI writes a complete document with
\pgfplotsset{compat=1.18} and a commented axis environment. - Preview and export. Open the Preview tab to compile the plot to PDF. Edit the code to fine-tune it, then export pgfplot.tex or pgfplot.pdf, or open it in Octree.
Common pgfplots errors and how to fix them
- Dimension too large. A function that grows very fast, such as
exp(x) over a wide domain, overflows TeX arithmetic. Narrow the domain, set restrict y to domain, or use a logarithmic axis. - Jagged curves. Raise
samples, for example samples=200, for smooth curves. Keep it lower for 3D plots, which compile much more slowly. - Plotting your own data. Replace the generated coordinates with your values using
\addplot table or \addplot coordinates; the axis styling stays the same.
PGFPlots generator FAQ
- What is a PGFPlots generator?
- It writes pgfplots code for you. pgfplots is the LaTeX package for drawing charts with TikZ; instead of learning its axis options, you describe the plot in plain English and get a complete document you can compile, edit and paste into a paper.
- Which kinds of plots can it make?
- Anything pgfplots can draw: function plots, line charts, bar charts, scatter plots, histograms, error bars, area plots and 3D surface or mesh plots. Describe the data, axes and style you want and the code reflects them.
- How do I put the plot in my LaTeX document?
- Add \usepackage{pgfplots} and \pgfplotsset{compat=1.18} to your preamble, then copy the tikzpicture environment from the generated code into your document, usually inside a figure environment with a caption.
- Is the PGFPlots generator free?
- Yes, it is free and needs no account. The code is written by an AI model (OpenAI GPT-5) and compiled with a full TeX Live distribution, so check the preview against what you asked for.
Learn the axis options in the pgfplots guide, draw diagrams with the TikZ generator, or turn a CSV into a table with the LaTeX table generator.