Skip to content
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

overlay_all_ratios plot missing centerlines when exported to PDF #23

Open
NanoExplorer opened this issue Mar 16, 2021 · 2 comments
Open
Assignees

Comments

@NanoExplorer
Copy link
Contributor

Hello again!
I recently exported my PDR model to PDF, and the PDF is missing the center-lines of each ratio in parameter space. It is unclear to me why this might be the case, as I have not yet had time to debug, and the .png export works fine. I'll attach the two files...
pdrmodel_alllines
pdrmodel_alllines.pdf

@mpound
Copy link
Owner

mpound commented Mar 22, 2021

I can reproduce this issue in my own sandbox. I suspect a matplotlib bug.

@mpound
Copy link
Owner

mpound commented Mar 22, 2021

It may have to do with PDF not preserving zorder of shading versus contours. A workaround is to add an extra call to ax.contour in _plot_no_wcs. At line 686 in modeplot.py:

if kwargs_opts['shading'] != 0:
    cset = self._axis[axidx].contourf(x.value,y.value,k.data,levels=m.levels, colors=colors,alpha=kwargs_opts['shading'])
    # Add extra call to plot contour because savefig("file.pdf") gets zorder of shading vs. contour wrong and contour lines don't show up. Only a bug when output is pdf. Harumph.
    # See https://github.com/mpound/pdrtpy/issues/23
    cset2 = self._axis[axidx].contour(x.value,y.value,k.data,levels=[m.levels[1]], colors=colors, alpha=kwargs_opts['shading'])
else:
    cset = self._axis[axidx].contour(x.value,y.value,k.data,levels=m.levels,
                                         linestyles=lstyles, colors=colors)

@mpound mpound self-assigned this Mar 24, 2021
mpound added a commit that referenced this issue Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants