Convert input CXC time (sec) to the time base required for the matplotlib plot_date function (days since start of year 1).
Parameters: | times – iterable list of times |
---|---|
Return type: | plot_date times |
Make a date plot where the X-axis values are in CXC time. If no fig value is supplied then the current figure will be used (and created automatically if needed). If yerr or xerr is supplied, errorbar() will be called and any additional keyword arguments will be passed to it. Otherwise any additional keyword arguments (e.g. fmt='b-') are passed through to the plot() function. Also see errorbar() for an explanation of the possible forms of yerr/xerr.
If the state_codes keyword argument is provided then the y-axis ticks and tick labels will be set accordingly. The state_codes value must be a list of (raw_count, state_code) tuples, and is normally set to msid.state_codes for an MSID object from fetch().
If the interactive keyword is True (default) then the plot will be redrawn at the end and a GUI callback will be created which allows for on-the-fly update of the date tick labels when panning and zooming interactively. Set this to False to improve the speed when making several plots. This will likely require issuing a plt.draw() or fig.canvas.draw() command at the end.
Parameters: |
|
---|---|
Return type: | ticklocs, fig, ax = tick locations, figure, and axes object. |
Interleave and then flatten two arrays x and y. This is typically useful for making a histogram style plot where x and y are the bin start and stop respectively. If no value for y is provided then x is used.
Example:
from Ska.Matplotlib import pointpair
x = np.arange(1, 100, 5)
x0 = x[:-1]
x1 = x[1:]
y = np.random.uniform(len(x0))
xpp = pointpair(x0, x1)
ypp = pointpair(y)
plot(xpp, ypp)
X: | left edge value of point pairs |
---|---|
Y: | right edge value of point pairs (optional) |
Return type: | np.array of length 2*len(x) == 2*len(y) |
Pick nice values to show time ticks in a date plot.
Example:
x = cxctime2plotdate(np.linspace(0, 3e7, 20))
y = np.random.normal(size=len(x))
fig = pylab.figure()
plt = fig.add_subplot(1, 1, 1)
plt.plot_date(x, y, fmt='b-')
ticklocs = set_time_ticks(plt)
fig.autofmt_xdate()
fig.show()
The returned value of ticklocs can be used in subsequent date plots to force the same major and minor tick locations and formatting. Note also the use of the high-level fig.autofmt_xdate() convenience method to configure vertically stacked date plot(s) to be well-formatted.
Parameters: |
|
---|---|
Return type: | tuple with selected ticklocs as first element |