x-labels missing from 1D plot

Open
#397 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
matplotlib, numpy, python

Research direction

Run the supplied NDCube example and confirm that my_cube[0, 0, :].plot() produces a 1D plot without x-labels. Start at the NDCube plot entry point and trace how the sliced WCS is used for axis labels. Done means the reproduced 1D plot displays the expected x-axis labels.

Written by the indexing model from the issue text.

Description

The code below produces a 1D plot that has no x-labels (on NDCube master)
Screenshot 2021-02-08 at 21 26 18

import astropy.wcs
import numpy as np

from ndcube import NDCube

# Define data array.
data = np.random.rand(4, 4, 5)
# Define WCS transformations in an astropy WCS object.
wcs = astropy.wcs.WCS(naxis=3)
wcs.wcs.ctype = 'WAVE', 'HPLT-TAN', 'HPLN-TAN'
wcs.wcs.cunit = 'Angstrom', 'deg', 'deg'
wcs.wcs.cdelt = 0.2, 0.5, 0.4
wcs.wcs.crpix = 0, 2, 2
wcs.wcs.crval = 10, 0.5, 1

# Now instantiate the NDCube
my_cube = NDCube(data, wcs=wcs)

import matplotlib.pyplot as plt
my_cube[0, 0, :].plot()
plt.show()
Dominant language
Python
Stars
49
Forks
56
Avg merge
5h 54m
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sunpy/ndcube

All issues in sunpy/ndcube

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.