Hi Steven,
According to http://matplotlib.org/users/pgf.html one has to do
matplotlib.use('pgf')
or
from matplotlib.backends.backend_pgf import FigureCanvasPgf
matplotlib.backend_bases.register_backend('pdf', FigureCanvasPgf)
Both work as expected in Python. In Julia the first one done as
matplotlib[:use]("pgf")
issues this warning (in REPL only, not in IJulia):
UserWarning: This call to matplotlib.use() has no effect
because the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.
That is something not easy to do before the "using PyPlot" :)
So I try the second way, but it was not possible to access the needed
Python modules/objects
from PyPlot.matplotlib alone, and that's why I had to rely on PyCall. Maybe
I'd missed something.
That took me sometime, but now I remember that what took me long time was
to realize that
println(PyPlot.matplotlib[:rcParams]["axes.linewidth"])
PyPlot.matplotlib[:rcParams]["axes.linewidth"] = 2 # this does not
work
println(PyPlot.matplotlib[:rcParams]["axes.linewidth"])
plt.rc("axes", linewidth=2) # but this works
println(PyPlot.matplotlib[:rcParams]["axes.linewidth"])
1.0
1.0
2.0
Sure, I should had report these issues in the first place but I got a
little lazy :p
On Monday, May 12, 2014 1:57:01 PM UTC+1, Steven G. Johnson wrote:
>
>
>
> On Monday, May 12, 2014 8:38:54 AM UTC-4, Cristóvão Duarte Sousa wrote:
>
>> It took me long time to figure out how to properly tell matplotlib (from
>> within Julia) to use that backend to
>> save PDF (I had to use PyCall in the end), but since then I've been
>> successfully using this feature in Julia.
>>
>
> Is this due to the complexity of Matplotlib itself (i.e. is it about the
> same difficulty in Python?), or is there some specific difficulty with
> PyPlot/PyCall?
>