Hvplot has default the position of the legend on the right outside of the plot.
How can I change this default legend position?
import numpy as np
import pandas as pd
import hvplot
import hvplot.pandas
import holoviews as hv
data = np.random.normal(size=[50, 2])
df = pd.DataFrame(data, columns=['a', 'b'])
df.hvplot.line()
You can change the legend position to top left by adding .opts(legend_position='top_left') to your code.
df.hvplot.line().opts(legend_position='top_left')
If you would like to position your legend inside your plot, you can choose from the following options:
['top_right', 'top_left', 'bottom_left', 'bottom_right']
If you want to place your legend outside your plot, you can choose from these options:
['right', 'left', 'top', 'bottom']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With