@@ -151,13 +151,19 @@ def in_notebook(out=None):
151151 Returns ``True`` if the module is running in IPython kernel,
152152 ``False`` if in IPython shell or other Python shell.
153153 """
154+ import sys
154155
155156 if out is not None :
156157 return True
158+ if "ipykernel" in sys .modules :
159+ return True
157160
158161 if "spyder" in sys .modules :
159162 return False
160163
164+ if 'debugpy' in sys .modules :
165+ return False
166+
161167 return "ipykernel" in sys .modules
162168
163169
@@ -177,7 +183,14 @@ def view(x, vars=None, autoscale=True, out=None, **kwargs):
177183 """
178184
179185 if "clim" in kwargs :
180- autoscale = False
186+ ignore = False
187+
188+ if kwargs ["clim" ][0 ] < 0 :
189+ if kwargs ["clim" ][1 ] > 0 :
190+ ignore = True
191+
192+ if not ignore :
193+ autoscale = False
181194
182195 coastline = False
183196
@@ -503,7 +516,8 @@ def view(x, vars=None, autoscale=True, out=None, **kwargs):
503516 intplot = df .hvplot (
504517 groupby = "variable" ,
505518 dynamic = True ,
506- responsive = (in_notebook () is False ),
519+ #responsive=(in_notebook() is False),
520+ responsive = False ,
507521 ** kwargs ,
508522 )
509523 if in_notebook (out ):
@@ -583,6 +597,9 @@ def view(x, vars=None, autoscale=True, out=None, **kwargs):
583597 self_max = ds .rename ({vars : "x" }).x .max ()
584598 self_min = ds .rename ({vars : "x" }).x .min ()
585599 v_max = float (max (self_max .values , - self_min .values ))
600+ if "clim" in kwargs :
601+ v_max = float (max (- kwargs ["clim" ][0 ], kwargs ["clim" ][1 ]))
602+
586603 else :
587604 self_max = 1
588605 self_min = 1
@@ -618,7 +635,8 @@ def view(x, vars=None, autoscale=True, out=None, **kwargs):
618635 y_var ,
619636 vars ,
620637 cmap = "RdBu_r" ,
621- responsive = (in_notebook () is False ),
638+ #responsive=(in_notebook() is False),
639+ responsive = False ,
622640 ** kwargs ,
623641 ).redim .range (** {vars : (- v_max , v_max )})
624642 else :
@@ -628,7 +646,8 @@ def view(x, vars=None, autoscale=True, out=None, **kwargs):
628646 vars ,
629647 cmap = "RdBu_r" ,
630648 rasterize = False ,
631- responsive = (in_notebook () is False ),
649+ #responsive=(in_notebook() is False),
650+ responsive = False ,
632651 ** kwargs ,
633652 ).redim .range (** {vars : (- v_max , v_max )})
634653
@@ -807,7 +826,8 @@ def view(x, vars=None, autoscale=True, out=None, **kwargs):
807826 .hvplot (
808827 groupby = "variable" ,
809828 dynamic = True ,
810- responsive = (in_notebook () is False ),
829+ #responsive=(in_notebook() is False),
830+ responsive = False ,
811831 ** kwargs ,
812832 )
813833 )
@@ -850,7 +870,9 @@ def view(x, vars=None, autoscale=True, out=None, **kwargs):
850870 coastline = coastline ,
851871 projection = projection ,
852872 rasterize = rasterize ,
853- responsive = in_notebook () is False ,
873+ #responsive=in_notebook() is False,
874+ responsive = False ,
875+
854876 ** kwargs ,
855877 )
856878 else :
@@ -874,7 +896,8 @@ def view(x, vars=None, autoscale=True, out=None, **kwargs):
874896 coastline = coastline ,
875897 rasterize = False ,
876898 projection = projection ,
877- responsive = in_notebook () is False ,
899+ #responsive=in_notebook() is False,
900+ responsive = False ,
878901 ** kwargs ,
879902 )
880903
@@ -902,6 +925,8 @@ def view(x, vars=None, autoscale=True, out=None, **kwargs):
902925 self_max = ds .rename ({vars : "x_dim12345" }).x_dim12345 .max ()
903926 self_min = ds .rename ({vars : "x_dim12345" }).x_dim12345 .min ()
904927 v_max = max (self_max .values , - self_min .values )
928+ if "clim" in kwargs :
929+ v_max = float (max (- kwargs ["clim" ][0 ], kwargs ["clim" ][1 ]))
905930 else :
906931 self_max = 1
907932 self_min = 1
@@ -928,7 +953,8 @@ def view(x, vars=None, autoscale=True, out=None, **kwargs):
928953 coastline = coastline ,
929954 projection = projection ,
930955 rasterize = rasterize ,
931- responsive = (in_notebook () is False ),
956+ #responsive=(in_notebook() is False),
957+ responsive = False ,
932958 ** kwargs ,
933959 ).redim .range (** {vars : (- v_max , v_max )})
934960 else :
@@ -941,7 +967,8 @@ def view(x, vars=None, autoscale=True, out=None, **kwargs):
941967 coastline = coastline ,
942968 projection = projection ,
943969 rasterize = rasterize ,
944- responsive = (in_notebook () is False ),
970+ #responsive=(in_notebook() is False),
971+ responsive = False ,
945972 ** kwargs ,
946973 )
947974 else :
@@ -965,7 +992,8 @@ def view(x, vars=None, autoscale=True, out=None, **kwargs):
965992 projection = projection ,
966993 rasterize = False ,
967994 cmap = "RdBu_r" ,
968- responsive = (in_notebook () is False ),
995+ #responsive=(in_notebook() is False),
996+ responsive = False ,
969997 ** kwargs ,
970998 ).redim .range (** {vars : (- v_max , v_max )})
971999 else :
@@ -978,7 +1006,8 @@ def view(x, vars=None, autoscale=True, out=None, **kwargs):
9781006 projection = projection ,
9791007 rasterize = False ,
9801008 cmap = "RdBu_r" ,
981- responsive = (in_notebook () is False ),
1009+ #responsive=(in_notebook() is False),
1010+ responsive = False ,
9821011 ** kwargs ,
9831012 )
9841013
@@ -1018,7 +1047,8 @@ def view(x, vars=None, autoscale=True, out=None, **kwargs):
10181047 coastline = coastline ,
10191048 projection = projection ,
10201049 rasterize = rasterize ,
1021- responsive = (in_notebook () is False ),
1050+ #responsive=(in_notebook() is False),
1051+ responsive = False ,
10221052 ** kwargs ,
10231053 ).redim .range (** {vars : (self_min .values , v_max )})
10241054 else :
@@ -1031,7 +1061,8 @@ def view(x, vars=None, autoscale=True, out=None, **kwargs):
10311061 coastline = coastline ,
10321062 projection = projection ,
10331063 rasterize = rasterize ,
1034- responsive = (in_notebook () is False ),
1064+ #responsive=(in_notebook() is False),
1065+ responsive = False ,
10351066 ** kwargs ,
10361067 )
10371068
@@ -1057,7 +1088,8 @@ def view(x, vars=None, autoscale=True, out=None, **kwargs):
10571088 coastline = coastline ,
10581089 rasterize = False ,
10591090 projection = projection ,
1060- responsive = (in_notebook () is False ),
1091+ #responsive=(in_notebook() is False),
1092+ responsive = False ,
10611093 ** kwargs ,
10621094 ).redim .range (** {vars : (self_min .values , v_max )})
10631095 else :
@@ -1070,7 +1102,8 @@ def view(x, vars=None, autoscale=True, out=None, **kwargs):
10701102 coastline = coastline ,
10711103 rasterize = False ,
10721104 projection = projection ,
1073- responsive = (in_notebook () is False ),
1105+ #responsive=(in_notebook() is False),
1106+ responsive = False ,
10741107 ** kwargs ,
10751108 )
10761109
0 commit comments