Skip to content

Commit

Permalink
Change default legend (#1225)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuang11 authored Dec 21, 2023
1 parent b4274d7 commit 7b4af0e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions hvplot/tests/testui.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def test_explorer_plot_code():
" kind='scatter',\n"
" x='bill_length_mm',\n"
" y=['bill_depth_mm'],\n"
" legend='bottom_right',\n"
" widget_location='bottom',\n"
")"
)
Expand All @@ -78,6 +79,7 @@ def test_explorer_plot_code():
" kind='scatter',\n"
" x='bill_length_mm',\n"
" y=['bill_depth_mm'],\n"
" legend='bottom_right',\n"
" widget_location='bottom',\n"
")"
)
Expand Down Expand Up @@ -280,6 +282,7 @@ def test_explorer_code_dataframe():
kind='points',
x='bill_length_mm',
y='species',
legend='bottom_right',
widget_location='bottom',
)"""
)
Expand All @@ -289,6 +292,7 @@ def test_explorer_code_dataframe():
kind='points',
x='bill_length_mm',
y='species',
legend='bottom_right',
widget_location='bottom',
)
```"""
Expand All @@ -305,6 +309,7 @@ def test_explorer_code_gridded():
kind='image',
x='lon',
y='lat',
legend='bottom_right',
widget_location='bottom',
)""")

Expand All @@ -316,6 +321,7 @@ def test_explorer_code_gridded():
kind='image',
x='lon',
y='lat',
legend='bottom_right',
widget_location='bottom',
)
```"""
Expand All @@ -333,6 +339,7 @@ def test_explorer_code_gridded_dataarray():
kind='image',
x='lon',
y='lat',
legend='bottom_right',
widget_location='bottom',
)""")

Expand All @@ -344,6 +351,7 @@ def test_explorer_code_gridded_dataarray():
kind='image',
x='lon',
y='lat',
legend='bottom_right',
widget_location='bottom',
)
```"""
Expand All @@ -361,6 +369,7 @@ def test_explorer_code_opts():
kind='image',
x='lon',
y='lat',
legend='bottom_right',
widget_location='bottom',
).opts(
color_levels=3,
Expand All @@ -374,6 +383,7 @@ def test_explorer_code_opts():
kind='image',
x='lon',
y='lat',
legend='bottom_right',
widget_location='bottom',
).opts(
color_levels=3,
Expand Down
4 changes: 3 additions & 1 deletion hvplot/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class Style(Controls):

class Axes(Controls):

legend = param.Selector(default='right', objects=_hvConverter._legend_positions)
legend = param.Selector(default='bottom_right', objects=_hvConverter._legend_positions)

logx = param.Boolean(default=False)

Expand Down Expand Up @@ -697,6 +697,8 @@ def plot_code(self, var_name=None):
Data variable name by which the returned string will start.
"""
settings = self.settings()
if "legend" not in settings:
settings["legend"] = "bottom_right"
settings["widget_location"] = "bottom"
settings_args = ''
if settings:
Expand Down

0 comments on commit 7b4af0e

Please sign in to comment.