@@ -1152,6 +1152,8 @@ def plot2D(
11521152 samples = [30 , 30 ],
11531153 force_data = True ,
11541154 disp_type = "surface" ,
1155+ alpha = 0.6 ,
1156+ cmap = "viridis" ,
11551157 ):
11561158 """Plot 2-Dimensional Function, from a lower limit to an upper limit,
11571159 by sampling the Function several times in the interval. The title of
@@ -1185,6 +1187,12 @@ def plot2D(
11851187 disp_type : string, optional
11861188 Display type of plotted graph, which can be surface, wireframe,
11871189 contour, or contourf. Default value is surface.
1190+ alpha : float, optional
1191+ Transparency of plotted graph, which can be a value between 0 and
1192+ 1. Default value is 0.6.
1193+ cmap : string, optional
1194+ Colormap of plotted graph, which can be any of the colormaps
1195+ available in matplotlib. Default value is viridis.
11881196
11891197 Returns
11901198 -------
@@ -1221,6 +1229,9 @@ def plot2D(
12211229 mesh = [[mesh_x_flat [i ], mesh_y_flat [i ]] for i in range (len (mesh_x_flat ))]
12221230 # Evaluate function at all mesh nodes and convert it to matrix
12231231 z = np .array (self .get_value (mesh )).reshape (mesh_x .shape )
1232+ z_min , z_max = z .min (), z .max ()
1233+ color_map = plt .cm .get_cmap (cmap )
1234+ norm = plt .Normalize (z_min , z_max )
12241235 # Plot function
12251236 if disp_type == "surface" :
12261237 surf = axes .plot_surface (
@@ -1229,9 +1240,11 @@ def plot2D(
12291240 z ,
12301241 rstride = 1 ,
12311242 cstride = 1 ,
1232- # cmap=cm.coolwarm ,
1243+ cmap = color_map ,
12331244 linewidth = 0 ,
1234- alpha = 0.6 ,
1245+ alpha = alpha ,
1246+ vmin = z_min ,
1247+ vmax = z_max ,
12351248 )
12361249 figure .colorbar (surf )
12371250 elif disp_type == "wireframe" :
0 commit comments