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

Multipanel plots with images don't work #729

Open
karenlmasters opened this issue Jun 24, 2021 · 1 comment
Open

Multipanel plots with images don't work #729

karenlmasters opened this issue Jun 24, 2021 · 1 comment

Comments

@karenlmasters
Copy link
Contributor

Trying to put an image into the Multiplot example here: https://sdss-marvin.readthedocs.io/en/latest/tutorials/plotting-tutorial.html#multi-panel-map-plot-single-galaxy by swapping out one of the map commands with an image command

import matplotlib.pyplot as plt
import numpy as np
from marvin.tools import Maps
from marvin.tools.image import Image

maps = Maps('7977-12705')

halpha = maps.emline_gflux_ha_6564
nii_ha = np.log10(maps.emline_gflux_nii_6585 / halpha)
stvel = maps.stellar_vel
stsig = maps.stellar_sigma
stsig_corr = stsig.inst_sigma_correction()
image = Image(plateifu='7977-12705')


with plt.style.context('seaborn-darkgrid'):
    fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(12, 11))
    halpha.plot(fig=fig, ax=axes[0, 0])
    nii_ha.plot(fig=fig, ax=axes[0, 1], title="log([NII]6585 / H-alpha)", snr_min=None)
    stvel.plot(fig=fig, ax=axes[1, 0])
    #stsig_corr.plot(fig=fig, ax=axes[1, 1])
    image.plot(fig=fig, ax=axes[1, 1])

Result does not put the image plot into the multipanel plot...?
Screen Shot 2021-06-24 at 11 00 41

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@havok2063
Copy link
Collaborator

Hi @karenlmasters the plot method on Maps objects is a custom function that handles matplotlib single panel or multi-panel plots. The Image.plot is a separate standalone plot function that just returns a single matplotlib figure. The ax=axes input to Image.plot isn't doing anything here. So I don't think what you want to do is possible out of the box. It's probably a good idea to make that work though.

You should be able to hack something together though, but you might need to use matplotlib directly, and extract the image data and maps data from the Marvin objects. You can take a look at the Image.plot code itself, https://github.com/sdss/marvin/blob/master/python/marvin/tools/image.py#L235-L275 itself. I know @KateRowlands needed to do something similar a while back, and may have some example code.

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