[yt-users] Using eps_writer with ProfilePlot causes AttributeError

Anni Järvenpää anni.jarvenpaa at gmail.com
Tue Jun 9 08:18:18 PDT 2015


Hi all,

I'm trying to use eps_writer to create figure that has both projections and
profiles as subplots, but every time I try to create one with profiles the
program crashes with following stack trace:

Traceback (most recent call last):
  File "myprogram.py", line 14, in <module>
    multiplot = eps.multiplot(cols, rows, plots)
  File "/.../yt-x86_64/src/yt-hg/yt/visualization/eps_writer.py", line
1120, in multiplot
    field=fields[index])
  File ".../yt-x86_64/src/yt-hg/yt/visualization/eps_writer.py", line 505,
in insert_image_yt
    plot._redraw_image()
AttributeError: 'ProfilePlot' object has no attribute '_redraw_image'

Here is a minimal example of a program that produces that error:
http://paste.yt-project.org/show/5617/. One plot could of course be saved
without eps_writer but if I want multiple plots to the same figure, I don't
know any other way of doing it if some of them are profiles.

I took a look at the source code of eps_writer and it seems that it is
intended to work with projections also because there are lines like line
504 which explicitly handles profiles: "elif isinstance(plot,
ProfilePlot):". I was able to work my way around the error by getting the
figure from the plot similarly to what is done in ProfilePlot source when
the plot is saved: I create an iterator to iterate through
plot.figures.iteritems() and get the figure to _p1. Unfortunately, then I
get errors from similar calls to functions and attributes that don't exist,
for example in code block starting from line 358, so I haven't been able to
get profiles to work. Of course it is also possible that my workaround does
not work correctly, because my understanding of yt source is not very
comprehensive.

Am I doing something wrong with eps_writer or profile creation? Or has
anyone else run into a similar problem and if so, how have you managed to
get around it? Is there any other way to get both profiles and projections
to same figure?


Thanks for your help

Anni Järvenpää
Summer Trainee
Division of Particle Physics and Astrophysics
University of Helsinki
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150609/2bc1cdaa/attachment.htm>


More information about the yt-users mailing list