python bokeh中的反向轴 [英] Reverse axis in python bokeh

查看:92
本文介绍了python bokeh中的反向轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在散景散点图中反转y轴并设置x和y的范围.我正在使用:

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

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

我得到一个错误:

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

任何想法都可以在具有熊猫数据框输入的Bokeh散点图中反转轴

Any idea how axes can be reversed in a Bokeh scatterplot with a pandas dataframe input

推荐答案

以下内容将翻转y轴以显示散点图.

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) 

这篇关于python bokeh中的反向轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆