@@ -586,7 +586,10 @@ def plot_colormap3dslice(filename=None,
586586 if datamap_unit_latex :
587587 cb_title_use = cb_title_use + r"\,[" + datamap_unit_latex + "]"
588588
589- datamap = np .reshape (datamap_info .data , np .shape (datamap ))
589+ if np .ndim (datamap_info .data ) == 1 : # Scalar variable
590+ datamap = np .reshape (datamap_info .data , np .shape (datamap ))
591+ else :
592+ datamap = np .reshape (datamap_info .data , np .shape (datamap )+ (np .shape (datamap_info .data )[1 ],))
590593 else :
591594 # Expression set, use generated or provided colorbar title
592595 cb_title_use = expression .__name__ + operatorstr
@@ -688,8 +691,12 @@ def plot_colormap3dslice(filename=None,
688691 pass_map = np .swapaxes (pass_map , 0 ,1 )
689692 else :
690693 # vlasov grid, AMR
691- pass_map = f .read_variable (mapval )
694+ if not limitedsize :
695+ pass_map = f .read_variable (mapval )
696+ else :
697+ pass_map = f .read_variable ("CellID" )
692698 pass_map = pass_map [indexids ] # sort
699+
693700 if pass3d :
694701 if np .ndim (pass_map )== 1 :
695702 pass_shape = None
@@ -718,6 +725,15 @@ def plot_colormap3dslice(filename=None,
718725 pass_map = pass_map [MaskX [0 ]:MaskX [- 1 ]+ 1 ,...]
719726 pass_map = pass_map [:,MaskY [0 ]:MaskY [- 1 ]+ 1 ,...]
720727
728+ if limitedsize :
729+ ids_list = pass_map .flatten ()
730+ passmap_list = f .read_variable (mapval , cellids = ids_list )
731+
732+ if np .ndim (passmap_list ) == 1 : # Scalar variable
733+ pass_map = np .reshape (passmap_list .data , np .shape (pass_map ))
734+ else :
735+ pass_map = np .reshape (passmap_list , np .shape (pass_map )+ (np .shape (passmap_list )[1 ],))
736+
721737 pass_maps [mapval ] = pass_map # add to the dictionary
722738 else :
723739 # Or gather over a number of time steps
@@ -819,15 +835,16 @@ def plot_colormap3dslice(filename=None,
819835 while True :
820836 diffvar = next (listofkeys )
821837 if diffvar != "dstep" : break
822- cb_title_use = pt .plot .mathmode (pt .plot .bfstring (pt .plot .rmstring ("DIFF0~" + diffvar .replace ("_" ,r"\_" ))))
838+ if cbtitle is None :
839+ cb_title_use = pt .plot .mathmode (pt .plot .bfstring (pt .plot .rmstring ("DIFF0~" + diffvar .replace ("_" ,r"\_" ))))
823840 # Evaluate time difference
824841 if diff :
825842 tvf = pt .vlsvfile .VlsvReader (filename )
826843 t0 = tvf .read_parameter ('time' )
827844 tvf1 = pt .vlsvfile .VlsvReader (diff )
828845 t1 = tvf1 .read_parameter ('time' )
829- if (not np .isclose (t1 - t0 , 0.0 , rtol = 1e-6 )):
830- plot_title = plot_title + " ~dt=" + str (t1 - t0 )
846+ if (not np .isclose (t1 - t0 , 0.0 , rtol = 1e-6 )) and title is None :
847+ plot_title = plot_title + r"$\qquad $" + " ~dt=" + str (round ( t1 - t0 , 2 ) )
831848
832849 #Optional user-defined expression used for color panel instead of a single pre-existing var
833850 if expression :
@@ -1320,7 +1337,7 @@ def plot_colormap3dslice(filename=None,
13201337 cbdir = "right"
13211338
13221339 # Colourbar title
1323- if len (cb_title_use )!= 0 :
1340+ if len (cb_title_use )!= 0 and cbtitle is None :
13241341 cb_title_use = pt .plot .mathmode (pt .plot .bfstring (cb_title_use ))
13251342
13261343 # Set flag which affects colorbar decimal precision
@@ -1344,11 +1361,11 @@ def plot_colormap3dslice(filename=None,
13441361 if not cbaxes :
13451362
13461363 cb .ax .tick_params (labelsize = fontsize3 ,width = thick ,length = 3 * thick ,rotation = 30 if cb_horizontal else 0 )
1347- cb_title = cax .set_title (cb_title_use ,fontsize = fontsize3 ,fontweight = 'bold ' , horizontalalignment = horalign )
1364+ cb_title = cax .set_title (cb_title_use ,fontsize = fontsize3 ,fontweight = 'normal ' , horizontalalignment = horalign )
13481365 cb_title .set_position ((0. ,1. + 0.025 * scale )) # avoids having colourbar title too low when fontsize is increased
13491366 else :
13501367 cb .ax .tick_params (labelsize = fontsize ,width = thick ,length = 3 * thick )
1351- cb_title = cax .set_title (cb_title_use ,fontsize = fontsize ,fontweight = 'bold ' , horizontalalignment = horalign )
1368+ cb_title = cax .set_title (cb_title_use ,fontsize = fontsize ,fontweight = 'normal ' , horizontalalignment = horalign )
13521369
13531370 # Perform intermediate draw if necessary to gain access to ticks
13541371 if (symlog is not None and np .isclose (vminuse / vmaxuse , - 1.0 , rtol = 0.2 )) or (not lin and symlog is None ):
0 commit comments