[Nix-dev] Is anyone using Julia with PyPlot?

Andreas Herrmann andreash87 at gmx.ch
Mon Dec 1 15:04:37 CET 2014


Hi everyone,

I'm having an issue with the Julia Nix-expression[1]. I am trying to use it together with the Julia package PyPlot[2] to plot figures with matplotlib. If I try it in the command-line interface, then no plots show up. I only get a textual representation of the figure objects. However, when I use `savefig("tmp.png")` then the plot is correctly saved to the output file. In the IJulia[3] notebook no inline plots are displayed after calls to `plot`, or `title`, only the textual object representations. However, if I call `gcf()` to retrieve the current figure object, then the plot is correctly displayed inline in the notebook. Within python everything works fine: Plots in the commandline `ipython --pylab=qt`, as well as in the notebook with `%matplotlib inline` are displayed as expected. I would like to get Julia to display plots in gui windows from the command-line, and inline in IJulia notebooks.

Please note, I am not sure if this is an issue with the Julia Nix-expression, or with the Julia package `PyPlot`. However, before posting an issue on the PyPlot project I would like to try and make sure that it's not an issue with my use of Nix. Hence, my question: Is anyone here using Julia as a Nix-package to create plots with matplotlib through PyPlot in the cli, or in an IJulia notebook? If so, how did you get it working?

I am running Julia within a nix-shell of the following expression:

{ nixpkgs ? <nixpkgs>
, system ? builtins.currentSystem }:

with (import nixpkgs { inherit system; });
let py = pkgs.pythonPackages; in

stdenv.mkDerivation {
  name = "dummy";
  src = ./empty;
  buildInputs = with py; [
    stdenv python readline ipython julia pyqt4 matplotlib
  ];
}

Best, Andreas

[1]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/compilers/julia/0.3.3.nix
[2]: https://github.com/stevengj/PyPlot.jl
[3]: https://github.com/JuliaLang/IJulia.jl



More information about the nix-dev mailing list