使用holoviews设置x和y标签 [英] Setting x and y labels with holoviews

查看:100
本文介绍了使用holoviews设置x和y标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将全息视图中图形的x和y轴上的标签更改为内部变量名称以外的其他名称.似乎影响轴标签的典型方法是将变量名称本身更改为标签.如果要使用复杂的标签,尤其是当您频繁地从其他复杂的数据对象(例如pandas数据框)转换时,这将非常不便.

I would like to change the labels on the x and y axis on a figure from holoviews to be something other than the internal variable name. It seems the typical way to affect the axis labels is to change the variable names themselves to the label. This is rather inconvenient if you want complex labels, especially if you are frequently converting from other complex data objects like pandas dataframes.

是否存在一种通用方法:(A)在绘制图形时或之后更改图形的x和y标签,或者(B)为变量名设置易于理解的别名?

Is there a general way to either: (A) change x and y labels of a figure as or after you plot it or (B) set up an human readable alias for variable names?

推荐答案

例如,您可以在绘制这样的图形时或之后更改轴标签

You can change the axis labels as or after you plot a figure like this for example

hv.Image(np.random.rand(10,10), kdims=['x','y']).redim.label(x='neXt', y='Ys')

在早期版本的HoloViews中,您可以像这样轻松地更改轴标签,请查看 Holoviews常见问题解答

In earlier versions of HoloViews you are able to change the axis labels easily like this, check the second answer on Holoviews FAQ

curve = hv.Curve(df, 'x_col', 'y_col')
curve = curve.options(xlabel='X Label', ylabel='Label for Y')

这篇关于使用holoviews设置x和y标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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