-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible bug: eps_writer doesn't retain formatting of SlicePlot object #4803
Comments
Hi, and welcome to yt! Thanks for opening your first issue. We have an issue template that helps us to gather relevant information to help diagnosing and fixing the issue. |
Does The eps_writer does a bunch of default decision making for you that is hard to override in from yt.visualization.eps_writer import DualEPS
import pyx
slc.refresh()
d = DualEPS()
d.insert_image_yt(slc, field=Field)
# use `axis_box` instead of `axis_box_yt` to avoid the xlim, ylim re-scaling
d.axis_box(
xrange=[slc.xlim[i] for i in (0, 1)],
yrange=[slc.ylim[i] for i in (0, 1)],
xlabel=slc.plots[Field].axes.get_xlabel(),
ylabel=slc.plots[Field].axes.get_ylabel(),
tickcolor=pyx.color.cmyk.black,
xlog=False,
ylog=False,
bare_axes=False,
)
# use `colorbar` instead of `colorbar_yt` to avoid adding units to
# the colorbar label.
_p = slc.plots[Field]
_norm = _p.norm_handler.get_norm(slc.frb[Field])
d.colorbar(slc[Field].colorbar_handler.cmap,
zrange=(_norm.vmin, _norm.vmax),
label=slc.frb[Field].info["label"],
log=True)
d.save_fig('fig_manual', format='pdf') The only thing I can't manage to match exactly is the colobar labels -- it seems PyX (the package yt is using to generate the eps) will automaticaly switch to scientific notation when the smallest value is < 1e-3 or the largest value is > 1e3, but even then it will decide where to place colorbar tick labels and so won't match yt's matplotlib style exactly. |
Ah, I didn't know about the |
@dunhamsj I'm not sure I get it. The |
It may be, and I just missed it. I was making this figure for a publication and so I went to the section of the docs that referred to "Publication-Ready Figures", and that section didn't mention the method that chrishaviln suggested. The docs seemed to rely on the eps_writer method |
Ah well, I guess that section title didn't age very well. |
Bug report
Bug summary
Saving a figure using
yt.visualization.eps_writer.single_plot( slc ).save_fig( 'fig', format = 'pdf' )
causes some of the formatting of the originalSlicePlot
to be lost. In particular, ticks and all three axis labels are different and theorigin
parameter seems to be reset.Code for reproduction
Actual outcome
Expected outcome
Version Information
I installed python with
pacman -S python
, made a virtual environment, and installed yt to the virtual environment.The text was updated successfully, but these errors were encountered: