If you don't set explicit bounds on your axis, its range will be a `DataRange1d`

, with bounds automatically computed from whatever you plot. In this case, setting the range's `flipped`

attribute will flip it without requiring you to set explicit bounds:

from bokeh.plotting import figure, show fig = figure() # Do some plotting calls with fig... fig.y_range.flipped = True show(fig)

The following will flip the y-axis for a scatter plot.

p = figure() xmin = data[xval].min() xmax = data[xval].max() ymin = data[yval].min() ymax = data[yval].max() # Note that ymin and ymax are in reverse order in y_range. p.scatter(xval, yval, x_range = (xmin, xmax), y_range = (ymax, ymin)) show(p)

I am trying to reverse the y axis and set anycodings_plot range for both x and y in a Bokeh scatter anycodings_plot plot. I am using:,If you want to set explicit bounds, see anycodings_bokeh this answer on another question. As Don anycodings_bokeh Smythe's answer mentions, you can set anycodings_bokeh the bounds in reverse order to invert anycodings_bokeh any axis type.,Any idea how axes can be reversed in a Bokeh anycodings_plot scatterplot with a pandas dataframe input,The following will flip the y-axis for a anycodings_bokeh scatter plot.

I am trying to reverse the y axis and set anycodings_plot range for both x and y in a Bokeh scatter anycodings_plot plot. I am using:

BokehPlot.bokeh_scatter(data = df, x_range = (min_utc, max_utc), y_range = (min_val, max_val))

I get an error:

`TypeError: bokeh_scatter() got an unexpected keyword argument 'x_range'`

If you don't set explicit bounds on your anycodings_bokeh axis, its range will be a DataRange1d, anycodings_bokeh with bounds automatically computed from anycodings_bokeh whatever you plot. In this case, setting anycodings_bokeh the range's flipped attribute will flip anycodings_bokeh it without requiring you to set explicit anycodings_bokeh bounds:

from bokeh.plotting import figure, show fig = figure() # Do some plotting calls with fig... fig.y_range.flipped = True show(fig)

The following will flip the y-axis for a anycodings_bokeh scatter plot.

p = figure() xmin = data[xval].min() xmax = data[xval].max() ymin = data[yval].min() ymax = data[yval].max() # Note that ymin and ymax are in reverse order in y_range. p.scatter(xval, yval, x_range = (xmin, xmax), y_range = (ymax, ymin)) show(p)

I've tried reversing the range to [10, 0] but this results in displacing the image, not fliping the y axis. The only way I've found to plotting it right is by flipping the numpy array lenna[::-1] before sending it to plot (but I guess it should be a better way).,I've used matplotlib and I've never wondered about this before because in matplotlib the default origin is the top left pixel (my case use). Searching a bit I found that as you suggest they also use a keyword origin= in the call to imshow to change between the two options:,Results with the image plotted upside down, as seen in the attached images (image is also converted to grayscale but this is not relevant):,Well I guess that's points to making the auto-fiipping configurable as well. But unless I am misunderstanding, not flipping is not consistent with the mental model above? If every pixel of an image has its own position, then flipping the range implies that the image would flip.

```
import bokeh.plotting as plt
from skimage.io
import imread
lenna = imread('/tmp/lenna.png', flatten = True)
p = plt.figure(x_range = [0, 10], y_range = [0, 10])
p.image(image = [lenna], x = 0, y = 0, dw = 10, dh = 10, palette = 'Greys9')
plt.show(p)
```

import numpy as np import PIL.Image lena_img = PIL.Image.open('lena.png') width_pixel, height_pixel = 512, 512 size_new = (width_pixel, height_pixel) lena_img = lena_img.resize(size_new).convert('RGBA') a = np.array(lena_img) # stack each tuple(R, G, B, A) to a UINT32, then reshape to(width, height) img = a.view(dtype = np.uint32).reshape(a.shape[: -1]) # reverse y axis manualy img = img[::-1] ... # reverse y_range plot = figure(x_range = (1, width_pixel), y_range = (height_pixel, 1), title = 'LENA', tools = 'reset,save', plot_height = height_pixel, plot_width = width_pixel) # enjoy plot.image_rgba(image = [img], x = 0, y = height_pixel, dw = width_pixel, dh = height_pixel)

invert_axis = None #( default) invert_axis = 0 # or 'y' invert_axis = 1 # or 'x' invert_axis = (0, 1) # or('y', 'x') or 'both'

for the option invert_yaxis=True it seems that there is a bug, the option works with matplotlib backend but don’t with bokeh backend even if the option exist in bokeh.,In order to invert the y axis you can also use : plot.opts(invert_yaxis=True) For your 2nd request I’m not sure of what you want to do. Maybe a hv.Area between a line at y=3000 and the edge of your plot will do the job. If you want more help can you provide a small reproducible example please ?,Thank you very much @AurelienSciarra for your quick reply. In my case plots.opts(invert_yaxis=True) didnt work:,My aim would be to have a plot similar to the one at the bottom (generated with matplotlib):

I generated the figure above with the command:

```
plot = myXarrayData.hvplot.contourf(z = 'V', x = 'refdist', y = 'depth',
levels = datatoplot['cf_levels'],
clabel = datatoplot['cbtitle'], label = datatoplot['pltitle'])
```

After digging the github issue log, I found the solution of using the recent implemented `transform`

argument:

```
reversedepth = -hv.dim('depth')
plot = myXarrayData.hvplot.contourf(z = 'V', x = 'refdist', y = 'depth',
transforms = dict(depth = reversedepth)
)
```

The two commands below generated the same plots…

```
import xarray as xr
import hvplot.xarray
import holoviews as hv
data = np.random.rand(3, 4)
refdist = np.array(range(100, 400, 100))
depth = np.array(range(5, 25, 5))
ds = xr.Dataset({
"V": (["refdist", "depth"], data),
},
coords = {
"refdist": (refdist),
"depth": (depth),
},
)
plot = ds['V'].hvplot.contourf(z = 'V', x = 'refdist', y = 'depth')
plot
```

plot.opts(invert_yaxis = True)

From this code:

```
Y = 20 + np.random.randint(10, size = (len(refdist)))
Y2 = 40 * np.ones(Y.shape)
AreaBelowPlot = hv.Area((refdist, -Y, -Y2), vdims = ['y', 'y2'])
(pl * AreaBelowPlot).opts(
hv.opts.Area(fill_color = 'saddlebrown')
)
```