Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i rotate x labels or y labels? (hvplot or holoviews)

I've created the following plot with hvplot and want to rotate the xlabels in this plot:

import numpy as np
import pandas as pd
import hvplot.pandas
import holoviews as hv

my_plot = pd.DataFrame(np.random.normal(size=[50, 2])).hvplot()

rotate xlabel hvplot question

like image 985
Sander van den Oord Avatar asked Jan 25 '23 22:01

Sander van den Oord


1 Answers

This can be done in 2 ways:

1) By adding it as argument of .hvplot(rot=90)

my_plot = pd.DataFrame(np.random.normal(size=[50, 2])).hvplot(rot=90)

2) By using .opts(xrotation=90), if you would like to rotate the labels by 90 degrees.
For y labels you can use option yrotation=90.

my_plot = pd.DataFrame(np.random.normal(size=[50, 2])).hvplot()
my_plot.opts(xrotation=90)

hvplot xlabels rotated 90 degrees

like image 115
Sander van den Oord Avatar answered Jan 28 '23 15:01

Sander van den Oord