Categorical Label for Image Plot?

Hi all-

I am trying to plot some astronomical data in Bokeh. One of my plots is an astronomy spectrum where it is a two-dimensional array where the cell values are the numbers of photons recorded by the telescope. Right now, I can plot the image and see the spectrum in Bokeh using the fig.image command. However, it would be extremely useful to chance the label of one of the axes to show the wavelengths that the pixel columns correspond to, rather than the number of the pixel column.

I’ve been looking at the examples given for categorical plots, but I’m not seeing any examples for the image type of plots. I’m also having some difficulty finding a good tutorial online.

I’ve already tried changing my initialization of the Bokeh plot from:

figPS = bokeh.plotting.Figure (title=‘Spectrum’,x_range=[0, numpy.shape(normed)[0]], y_range=[0, numpy.shape(normed)[1]])

to:

figPS = bokeh.plotting.Figure (title=‘Paint Strip’,x_range=[0, numpy.shape(normed)[0]], y_range=[wavegrid[0], wavegrid[-1]])

by changing the y_range to the lower and upper limits of my wavelength grid (as the categorial examples online seem to suggest), however this just produces an empty Bokeh plot - it looks like it rather changes the y-axis limits to plot a range outside of my data.

Does anyone know how to tackle this issue?

Thanks,

Rob

Rob,

There is a categorical heatmap demonstrated here:

  http://bokeh.pydata.org/en/latest/docs/gallery/categorical.html

Another possible option is to simply use integer numeric coordinates, and change the appearance of the ticks with a custom TickFormatter. This is demonstrated here:

  http://stackoverflow.com/questions/37534927/formatting-log-axis-labels-with-proper-superscripts-in-bokeh

Thanks,

Bryan

···

On Jun 1, 2016, at 6:51 PM, Rob <[email protected]> wrote:

Hi all-

I am trying to plot some astronomical data in Bokeh. One of my plots is an astronomy spectrum where it is a two-dimensional array where the cell values are the numbers of photons recorded by the telescope. Right now, I can plot the image and see the spectrum in Bokeh using the fig.image command. However, it would be extremely useful to chance the label of one of the axes to show the wavelengths that the pixel columns correspond to, rather than the number of the pixel column.

I've been looking at the examples given for categorical plots, but I'm not seeing any examples for the image type of plots. I'm also having some difficulty finding a good tutorial online.

I've already tried changing my initialization of the Bokeh plot from:

figPS = bokeh.plotting.Figure (title='Spectrum',x_range=[0, numpy.shape(normed)[0]], y_range=[0, numpy.shape(normed)[1]])

to:

figPS = bokeh.plotting.Figure (title='Paint Strip',x_range=[0, numpy.shape(normed)[0]], y_range=[wavegrid[0], wavegrid[-1]])

by changing the y_range to the lower and upper limits of my wavelength grid (as the categorial examples online seem to suggest), however this just produces an empty Bokeh plot - it looks like it rather changes the y-axis limits to plot a range outside of my data.

Does anyone know how to tackle this issue?

Thanks,
  Rob

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/31324e1b-f5bd-43e0-be77-4e2565c643d5%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.