Why individual plots have to be saved before being handed to eps_writer?
Hi All, I have been updating the eps_writer to handle a mixture of profiles, slices and projections that can be displayed in a single plot (multiple panels). eps_writer with my edits can be reviewed at http://paste.yt-project.org/show/5773/. However, in order to get the plot axes to work correctly I need to save the individual plots as well before passing them to the eps_writer. Here is an example script: http://paste.yt-project.org/show/5772/. It works correctly as is, but uncommenting the changes in plots causes weird results if I don't also save the individual plots. The result of saving and not-saving are below (as you can see the plot doesn't change but the axes/colorbar does). http://www.mv.helsinki.fi/home/aajarven/yt/noedit.png http://www.mv.helsinki.fi/home/aajarven/yt/edits-nosave.png http://www.mv.helsinki.fi/home/aajarven/yt/edits-save.png Does anyone know why the plots must be saved before being handed to the eps_writer api? I'd like to push these changes to the eps_writer and could possibly raise the save as a bug? Let me know. Anni
Hi Anni, I think it's just an issue with how the plots are generated -- saving makes sure they are the latestversion. I think it would be great to push something to warn the user if it hasn't been set up yet! -MAtt On Mon, Aug 3, 2015 at 7:45 AM, Anni Järvenpää <anni.jarvenpaa@gmail.com> wrote:
Hi All,
I have been updating the eps_writer to handle a mixture of profiles, slices and projections that can be displayed in a single plot (multiple panels). eps_writer with my edits can be reviewed at http://paste.yt-project.org/show/5773/. However, in order to get the plot axes to work correctly I need to save the individual plots as well before passing them to the eps_writer.
Here is an example script: http://paste.yt-project.org/show/5772/. It works correctly as is, but uncommenting the changes in plots causes weird results if I don't also save the individual plots. The result of saving and not-saving are below (as you can see the plot doesn't change but the axes/colorbar does). http://www.mv.helsinki.fi/home/aajarven/yt/noedit.png http://www.mv.helsinki.fi/home/aajarven/yt/edits-nosave.png http://www.mv.helsinki.fi/home/aajarven/yt/edits-save.png
Does anyone know why the plots must be saved before being handed to the eps_writer api? I'd like to push these changes to the eps_writer and could possibly raise the save as a bug?
Let me know.
Anni
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
It's because the plots are not actually created until they are about to be saved to disk. This was a performance improvement that was added more recently tha. The eps writer and it looks like the eps writer was never updated to handle it. Take a look at the validate_plot decorator in yt/visualization/plot_container.py, any function decorated with this will make sure the matplotlib figure and axes exist and have a valid plot. I agree with Matt that this sounds like a great addition, very much looking forward to the pull request! On Monday, August 3, 2015, Matthew Turk <matthewturk@gmail.com> wrote:
Hi Anni,
I think it's just an issue with how the plots are generated -- saving makes sure they are the latestversion. I think it would be great to push something to warn the user if it hasn't been set up yet!
-MAtt
Hi All,
I have been updating the eps_writer to handle a mixture of profiles, slices and projections that can be displayed in a single plot (multiple panels). eps_writer with my edits can be reviewed at http://paste.yt-project.org/show/5773/. However, in order to get the
On Mon, Aug 3, 2015 at 7:45 AM, Anni Järvenpää <anni.jarvenpaa@gmail.com <javascript:;>> wrote: plot
axes to work correctly I need to save the individual plots as well before passing them to the eps_writer.
Here is an example script: http://paste.yt-project.org/show/5772/. It works correctly as is, but uncommenting the changes in plots causes weird results if I don't also save the individual plots. The result of saving and not-saving are below (as you can see the plot doesn't change but the axes/colorbar does). http://www.mv.helsinki.fi/home/aajarven/yt/noedit.png http://www.mv.helsinki.fi/home/aajarven/yt/edits-nosave.png http://www.mv.helsinki.fi/home/aajarven/yt/edits-save.png
Does anyone know why the plots must be saved before being handed to the eps_writer api? I'd like to push these changes to the eps_writer and could possibly raise the save as a bug?
Let me know.
Anni
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org <javascript:;> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org <javascript:;> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Anni, I just wanted to echo Nathan's and Matt's comments and say that eps_writer relies on the image and axes ranges that are stored in the PlotWindow. So if the image hasn't been updated with the new colormap, ranges, etc., which happens just before the image is created, the original image will be inserted into the eps_writer framework. If you need any help with creating this pull request, please let us know! Thanks, John On 08/03/2015 10:25 AM, Nathan Goldbaum wrote:
It's because the plots are not actually created until they are about to be saved to disk. This was a performance improvement that was added more recently tha. The eps writer and it looks like the eps writer was never updated to handle it.
Take a look at the validate_plot decorator in yt/visualization/plot_container.py, any function decorated with this will make sure the matplotlib figure and axes exist and have a valid plot.
I agree with Matt that this sounds like a great addition, very much looking forward to the pull request!
On Monday, August 3, 2015, Matthew Turk <matthewturk@gmail.com <mailto:matthewturk@gmail.com>> wrote:
Hi Anni,
I think it's just an issue with how the plots are generated -- saving makes sure they are the latestversion. I think it would be great to push something to warn the user if it hasn't been set up yet!
-MAtt
On Mon, Aug 3, 2015 at 7:45 AM, Anni Järvenpää <anni.jarvenpaa@gmail.com <javascript:;>> wrote: > Hi All, > > I have been updating the eps_writer to handle a mixture of profiles, slices > and projections that can be displayed in a single plot (multiple panels). > eps_writer with my edits can be reviewed at > http://paste.yt-project.org/show/5773/. However, in order to get the plot > axes to work correctly I need to save the individual plots as well before > passing them to the eps_writer. > > Here is an example script: http://paste.yt-project.org/show/5772/. It works > correctly as is, but uncommenting the changes in plots causes weird results > if I don't also save the individual plots. The result of saving and > not-saving are below (as you can see the plot doesn't change but the > axes/colorbar does). > http://www.mv.helsinki.fi/home/aajarven/yt/noedit.png > http://www.mv.helsinki.fi/home/aajarven/yt/edits-nosave.png > http://www.mv.helsinki.fi/home/aajarven/yt/edits-save.png > > Does anyone know why the plots must be saved before being handed to the > eps_writer api? > I'd like to push these changes to the eps_writer and could possibly raise > the save as a bug? > > Let me know. > > Anni > > _______________________________________________ > yt-users mailing list > yt-users@lists.spacepope.org <javascript:;> > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org > _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org <javascript:;> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- John Wise Assistant Professor of Physics Center for Relativistic Astrophysics, Georgia Tech http://cosmo.gatech.edu
Hi and thanks for your help I managed to solve the problem by calling _setup_plots fof all yt plots before passing them to insert_image_yt or axis_box_yt, that seems to validate them. I'll create a pull request so you can review my changes. Anni ma 3. elokuuta 2015 klo 19.03 John Wise <jwise@physics.gatech.edu> kirjoitti:
Hi Anni,
I just wanted to echo Nathan's and Matt's comments and say that eps_writer relies on the image and axes ranges that are stored in the PlotWindow. So if the image hasn't been updated with the new colormap, ranges, etc., which happens just before the image is created, the original image will be inserted into the eps_writer framework.
If you need any help with creating this pull request, please let us know!
Thanks, John
It's because the plots are not actually created until they are about to be saved to disk. This was a performance improvement that was added more recently tha. The eps writer and it looks like the eps writer was never updated to handle it.
Take a look at the validate_plot decorator in yt/visualization/plot_container.py, any function decorated with this will make sure the matplotlib figure and axes exist and have a valid
On 08/03/2015 10:25 AM, Nathan Goldbaum wrote: plot.
I agree with Matt that this sounds like a great addition, very much looking forward to the pull request!
On Monday, August 3, 2015, Matthew Turk <matthewturk@gmail.com <mailto:matthewturk@gmail.com>> wrote:
Hi Anni,
I think it's just an issue with how the plots are generated -- saving makes sure they are the latestversion. I think it would be great to push something to warn the user if it hasn't been set up yet!
-MAtt
On Mon, Aug 3, 2015 at 7:45 AM, Anni Järvenpää <anni.jarvenpaa@gmail.com <javascript:;>> wrote: > Hi All, > > I have been updating the eps_writer to handle a mixture of profiles, slices > and projections that can be displayed in a single plot (multiple panels). > eps_writer with my edits can be reviewed at > http://paste.yt-project.org/show/5773/. However, in order to get the plot > axes to work correctly I need to save the individual plots as well before > passing them to the eps_writer. > > Here is an example script: http://paste.yt-project.org/show/5772/. It works > correctly as is, but uncommenting the changes in plots causes weird results > if I don't also save the individual plots. The result of saving
and
> not-saving are below (as you can see the plot doesn't change but
the
> axes/colorbar does). > http://www.mv.helsinki.fi/home/aajarven/yt/noedit.png > http://www.mv.helsinki.fi/home/aajarven/yt/edits-nosave.png > http://www.mv.helsinki.fi/home/aajarven/yt/edits-save.png > > Does anyone know why the plots must be saved before being handed to the > eps_writer api? > I'd like to push these changes to the eps_writer and could possibly raise > the save as a bug? > > Let me know. > > Anni > > _______________________________________________ > yt-users mailing list > yt-users@lists.spacepope.org <javascript:;> > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org > _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org <javascript:;> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- John Wise Assistant Professor of Physics Center for Relativistic Astrophysics, Georgia Tech http://cosmo.gatech.edu _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (4)
-
Anni Järvenpää
-
John Wise
-
Matthew Turk
-
Nathan Goldbaum