I've just started using LyX for my Economics essays. Using Inkscape, I have been able to create some very neat diagrams to go with them.

However I really need to be able to insert graphs (XY charts, bar charts, histograms etc.) into the document, preferably without having to go via excel. I don't need anything fancy, just something that works with LyX.

  • @Caramdir: I am sorry, I misunderstood. I thought @Patrick wants to import the graphs he have made in advance. – xport May 30 '11 at 16:53
  • @xport: It is somewhat ambivalently worded, but the accepted answer suggests pgfplots. – Caramdir May 30 '11 at 16:55

pgfplots is phenomenal. It's also totally TeX based so you can import your data and plot in one fell swoop. The package author is very active and the syntax is very tikz-y, so it's easy to learn.

  • Very pleased with this suggestion. I'm afraid I haven't had time to try the other suggestions (but I'm sure they are equally as good). Many thanks for all responses! – Patrick Beardmore Nov 16 '10 at 0:15
  • I'm convinced that pgfplots is the best way to get high quality graphs in LaTeX. Modulo the negligible inconvenience of having to export your data from whatever created it. – Will Robertson Nov 16 '10 at 14:11

I would recommend you try and use matplotlib, which is a mature and extremely well designed plotting suite. It's aim is to produce paper quality graphics, so it can output in pdf, svg, eps formats, to name the most important. It also allows you to embed TeX math equations in your graphics.

It is coded in python, thus anything you learn about the language might be reusable. Don't worry though, it doesn't require you to master python. The link above points to the matplotlib gallery, which contains a whole lot of examples and their source code. Just pick one you like, swap datas for yours and bingo.

  • I suggest this as well, and maybe you can add matplotlib2tikz. It converts the matplotlib plot to pgfplots/tikz. It works great, the generated code is clean and the script is regularly maintained. – pythonista Mar 19 '13 at 22:25

You may be able to use the answers from this question: Function Graph in LaTeX


Perhaps you can use Gnuplot. See here for a short description.


For more complicated graphs, it might be worth looking into R and Sweave. Although I expect this will break LyX in a variety of interesting ways, but you LyX should only be a gateway to writing real LaTeX anyway...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.