ANN: PGF/TikZ packages

1,229 views
Skip to first unread message

Mykel Kochenderfer

unread,
Aug 21, 2014, 5:05:08 PM8/21/14
to julia...@googlegroups.com
There are three new Julia packages for interfacing with PGF/TikZ for making publication-quality graphics.
  1. TikzPictures.jl. Basic interface to PGF/TikZ. Images can be saved as PDF, SVG, and TEX. If using IJulia, it will output SVG images.
  2. PGFPlots.jl. Plotting tool that uses the pgfplots package (built on top of TikZ).
  3. TikzGraphs.jl. Graph layout package using algorithms built into PGF/TikZ 3.0+.
Documentation is provided with each package. Installation of the dependencies (e.g., pdf2svg and pgfplots) is still a bit manual, but instructions are in the documentation.

Kevin Squire

unread,
Aug 21, 2014, 11:10:33 PM8/21/14
to julia...@googlegroups.com
Mykel, thank you for creating these packages!  I was quite impressed with Tikz examples (way) back when I was writing my thesis, but never took the time to learn how to use them properly. I guess I still probably won't do that, but your packages make it much more likely that I'll explore them!

Cheers,
   Kevin

Hisham Assi

unread,
Aug 22, 2014, 4:49:51 PM8/22/14
to julia...@googlegroups.com
Good news, I like pgflots. Thank You.

Kaj Wiik

unread,
Aug 22, 2014, 6:22:34 PM8/22/14
to julia...@googlegroups.com
Hi!

I've been using Tikz, so this package is very welcome!

However,
using PGFPlots
a=plot(rand(20),rand(20))
save("test.pdf", a)
ERROR: `save` has no method matching save(::ASCIIString, ::TikzPicture)

Any suggestions?

This is in Julia 0.3.0 and Ubuntu 14.04.

Cheers,
Kaj

Valentin Churavy

unread,
Aug 23, 2014, 9:11:45 AM8/23/14
to julia...@googlegroups.com
There is also a PGF backend for Compose which is used by Gadfly, which is producing quite nice plots.

Pablo Zubieta

unread,
Aug 23, 2014, 10:05:29 AM8/23/14
to julia...@googlegroups.com
@Kaj Wiik

I believe you need to use:

a = Plot.Linear(rand(20), rand(20))

Checkout here:

http://nbviewer.ipython.org/github/sisl/PGFPlots.jl/blob/master/doc/PGFPlots.ipynb

Cheers,
Pablo

Pablo Zubieta

unread,
Aug 23, 2014, 10:09:10 AM8/23/14
to julia...@googlegroups.com
@Kaj Wiik

Sorry! There is a typo, it should be:

a = Plots.Linear(rand(20), rand(20))

Pablo

Kaj Wiik

unread,
Aug 23, 2014, 11:17:24 AM8/23/14
to julia...@googlegroups.com
Yes, now it works perfectly, except that 
save("test.pdf", a)

produces "test.pdf.pdf".

I tried the first example but obviously it works only in IJulia.

Thanks!

Kaj

Mykel Kochenderfer

unread,
Aug 25, 2014, 1:05:39 AM8/25/14
to julia...@googlegroups.com
@Kaj Wiik: Thanks for letting me know of this issue. It is fixed with v0.0.2 of TikzPictures. Feel free to file an issue if you encounter any other trouble.

David van Leeuwen

unread,
Jan 21, 2015, 8:21:46 AM1/21/15
to julia...@googlegroups.com
Hello, 
This looks great, thanks.   

However, I run into problems with PGFPlots:

Error saving as SVG
ERROR
: The pdf generation failed.
 
Be sure your latex libraries are fully up to date!
 
You tried: `lualatex --enable-write18 --output-directory=. tikzpicture`

The latex on my system (I think a tex live latex on mac) is pdflatex. Does anyone know how I can configure this in PGFPlots?

Thanks

---david

Mykel Kochenderfer

unread,
Jan 21, 2015, 2:02:14 PM1/21/15
to julia...@googlegroups.com
You need to make sure you are running texlive 2014. If you are indeed running texlive 2014, then I'm happy to look into this more deeply with you. Please file an issue with the code you're trying to use to plot. If you want to try digging into it a little on your own, you can follow these steps:
1. run "using TikzPictures"
2. run "tikzDeleteIntermediate(false)"
3. rerun the commands you used to plot
4. go into the console and run "lualatex tikzpicture" on the tikzpicture.tex that is generated in the current directory
5. the errors you get in step 4 should give a hint as to what is wrong

David van Leeuwen

unread,
Jan 22, 2015, 9:47:54 AM1/22/15
to julia...@googlegroups.com
Hello Mykel,


On Wednesday, January 21, 2015 at 8:02:14 PM UTC+1, Mykel Kochenderfer wrote:
You need to make sure you are running texlive 2014. If you are indeed running texlive 2014, then I'm happy to look into this more deeply with you. Please file an issue with the code you're trying to use to plot. If you want to try digging into it a little on your own, you can follow these steps:
1. run "using TikzPictures"
2. run "tikzDeleteIntermediate(false)"
3. rerun the commands you used to plot
4. go into the console and run "lualatex tikzpicture" on the tikzpicture.tex that is generated in the current directory
5. the errors you get in step 4 should give a hint as to what is wrong

Thanks, this was very helpful. 

In my case I had to 
 - install texlive 2014 (from mactex, old version was 2009)
 - update / upgrade brew
 - install pdf2svg (using `brew homebrew/x11/pdf2svg`)

which all in all took several hours on my old laptop (2010), and a system crash.  

Cheers, 

---david 

Yakir Gagnon

unread,
Jan 31, 2015, 9:12:07 PM1/31/15
to julia...@googlegroups.com
Awesome work.

Mario Chemnitz

unread,
Feb 4, 2015, 4:52:00 AM2/4/15
to julia...@googlegroups.com
Hi Mykel,

since some days I try to get PGFPlots running on my Mac. I am using Julia v.0.3.5 and the Juno Editor. My minimal example is:

x = linspace(1,1.1,1000);
xx = 1./x;
using PGFPlots
plot(xx,real(fft(x)))
 
This example works within my IJulia Notebook, but not on Juno. I tested the pdf2svg and the lualatex terminal commands successfully (both without called options). So both packages are installed and working. But still, when I want to run the example above I'll get again and again:

could not spawn `lualatex --enable-write18 --output-directory=.tikzpicture`: no such file or directory (ENOENT)
...
Error saving as SVG 

Any advice?

It seemed to me that Julia is an ideal language to combine large scale computing with beautiful Tex-Plots. It would be great to get this working.
Best regards,
Mario.
Reply all
Reply to author
Forward
0 new messages