Skip to content

tplotxy (or similar tool) should work with 1-D non-timeseries data #1326

@jameswilburlewis

Description

@jameswilburlewis

Vassilis had to drop down to matplotlib in one of his homework solutions, which involved a log-log plot of power vs frequency for a particular variable:

import matplotlib.pyplot as plt
freq = thd_scw_fac_z_clip_pwrspc.v[0,:]   # frequency (Hz)
psd  = thd_scw_fac_z_clip_pwrspc.y[0,:]   # power spectrum

plt.figure(figsize=(6,4))
plt.loglog(freq, psd)

plt.xlim(1., 4e3)
plt.ylim(1e-10, 1e-5)

plt.xlabel('f [Hz]')
plt.ylabel('thd_scw_fac_z_pwrspc [nT²/Hz]')
plt.title('Quiet time dynamic power spectrum')

plt.grid(True, which='both', ls='--', alpha=0.4)
plt.show()

tplotxy could probably be modified to handle this, but we'd want some extra features:

  • allow passing X and Y as arrays instead of tplot variables
  • options for log scaling on both X and Y axes
  • coordinate grids on/off/transparency/linestyle

It's also worth thinking about how we might support non-time-series data in store_data/get_data. Right now we assume the X coordinate is always time, it always gets converted to np.datetime64 going in and Unix seconds coming out, and these assumptions are baked in throughout the code.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions