MCPcopy Create free account
hub / github.com/holoviz/hvplot / TestXarrayTitle

Class TestXarrayTitle

hvplot/tests/testoptions.py:670–720  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

668
669@pytest.mark.usefixtures('load_xarray_accessor')
670class TestXarrayTitle:
671 def test_dataarray_2d_with_title(self, da, backend):
672 da_sel = da.sel(time=0, band=0)
673 plot = da_sel.hvplot() # Image plot
674 opts = Store.lookup_options(backend, plot, 'plot')
675 assert opts.kwargs['title'] == 'time = 0, band = 0'
676
677 def test_dataarray_1d_with_title(self, da, backend):
678 da_sel = da.sel(time=0, band=0, x=0)
679 plot = da_sel.hvplot() # Line plot
680 opts = Store.lookup_options(backend, plot, 'plot')
681 assert opts.kwargs['title'] == 'time = 0, x = 0, band = 0'
682
683 def test_dataarray_1d_and_by_with_title(self, da, backend):
684 da_sel = da.sel(time=0, band=0, x=[0, 1])
685 plot = da_sel.hvplot(by='x') # Line plot with hue/by
686 opts = Store.lookup_options(backend, plot, 'plot')
687 assert opts.kwargs['title'] == 'time = 0, band = 0'
688
689 def test_override_title(self, da, backend):
690 da_sel = da.sel(time=0, band=0)
691 plot = da_sel.hvplot(title='title') # Image plot
692 opts = Store.lookup_options(backend, plot, 'plot')
693 assert opts.kwargs['title'] == 'title'
694
695 def test_dataarray_4d_line_no_title(self, da, backend):
696 plot = da.hvplot.line(dynamic=False) # Line plot with widgets
697 opts = Store.lookup_options(backend, plot.last, 'plot')
698 assert 'title' not in opts.kwargs
699
700 def test_dataarray_3d_histogram_with_title(self, da, backend):
701 da_sel = da.sel(time=0)
702 plot = da_sel.hvplot() # Histogram and no widgets
703 opts = Store.lookup_options(backend, plot, 'plot')
704 assert opts.kwargs['title'] == 'time = 0'
705
706 def test_dataset_empty_raises(self, ds1, backend):
707 with pytest.raises(ValueError, match='empty xarray.Dataset'):
708 ds1.drop_vars('foo').hvplot()
709
710 def test_dataset_one_var_behaves_like_dataarray(self, ds1, backend):
711 ds_sel = ds1.sel(time=0, band=0)
712 plot = ds_sel.hvplot() # Image plot
713 opts = Store.lookup_options(backend, plot, 'plot')
714 assert opts.kwargs['title'] == 'time = 0, band = 0'
715
716 def test_dataset_scatter_with_title(self, ds2, backend):
717 ds_sel = ds2.sel(time=0, band=0, x=0, y=0)
718 plot = ds_sel.hvplot.scatter(x='foo', y='bar') # Image plot
719 opts = Store.lookup_options(backend, plot, 'plot')
720 assert opts.kwargs['title'] == 'time = 0, y = 0, x = 0, band = 0'
721
722
723@pytest.mark.usefixtures('load_xarray_accessor')

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…