diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx index b77c69b2f77..0586a96ae55 100644 --- a/src/sage/plot/complex_plot.pyx +++ b/src/sage/plot/complex_plot.pyx @@ -563,7 +563,7 @@ def complex_to_cmap_rgb(z_values, cmap='turbo', contoured=False, tiled=False, import matplotlib as mpl if isinstance(cmap, str): - cmap = mpl.cm.get_cmap(cmap) + cmap = mpl.colormaps[cmap] if contour_base is None: if contour_type == "linear": @@ -1206,11 +1206,11 @@ def complex_plot(f, x_range, y_range, contoured=False, tiled=False, cmap=None, domain = np.linspace(0, 1, 256) shifted_domain = np.roll(domain, 128) default_cmap = mpl.colors.LinearSegmentedColormap.from_list( - "sage_default", mpl.cm.get_cmap('hsv')(shifted_domain) + "sage_default", mpl.colormaps['hsv'](shifted_domain) ) cmap = default_cmap else: - cmap = mpl.cm.get_cmap(cmap) + cmap = mpl.colormaps[cmap] rgbs = complex_to_cmap_rgb( z_values, cmap=cmap, contoured=contoured, tiled=tiled, contour_type=contour_type, contour_base=contour_base, diff --git a/src/sage/plot/contour_plot.py b/src/sage/plot/contour_plot.py index c0cab456686..4accb309580 100644 --- a/src/sage/plot/contour_plot.py +++ b/src/sage/plot/contour_plot.py @@ -848,9 +848,7 @@ def f(x,y): return cos(x) + sin(y) sage: contour_plot(lambda x,y: 0, (-1,1), (-1,1), ....: contours=[0], fill=False, cmap=['blue']) - ... - UserWarning: No contour levels were found within the data range. - Graphics object consisting of 1 graphics primitive + ...Graphics object consisting of 1 graphics primitive .. PLOT:: @@ -874,8 +872,7 @@ def f(x,y): return cos(x) + sin(y) Check that :trac:`18074` is fixed:: sage: contour_plot(0, (0,1), (0,1)) - ... UserWarning: No contour levels were found within the data range. - Graphics object consisting of 1 graphics primitive + ...Graphics object consisting of 1 graphics primitive Domain points in :trac:`11648` with complex output are now skipped:: diff --git a/src/sage/plot/graphics.py b/src/sage/plot/graphics.py index 64ea1a7e10f..cdc99ced263 100644 --- a/src/sage/plot/graphics.py +++ b/src/sage/plot/graphics.py @@ -2341,7 +2341,7 @@ def _matplotlib_tick_formatter(self, subplot, base=(10, 10), sage: subplot = Figure().add_subplot(111) sage: p._objects[0]._render_on_subplot(subplot) sage: p._matplotlib_tick_formatter(subplot, **d) - (, + (, , , , diff --git a/src/sage/plot/multigraphics.py b/src/sage/plot/multigraphics.py index 99c817f03a6..ae85183dc93 100644 --- a/src/sage/plot/multigraphics.py +++ b/src/sage/plot/multigraphics.py @@ -1207,7 +1207,7 @@ def _add_subplot(self, figure, index, **options): sage: fig = Figure() sage: ax1 = G._add_subplot(fig, 0) sage: type(ax1) - + sage: ax2 = G._add_subplot(fig, 1) sage: fig.get_axes() == [ax1, ax2] True diff --git a/src/sage/plot/plot3d/plot_field3d.py b/src/sage/plot/plot3d/plot_field3d.py index bdf39391d3e..fe10e27f58f 100644 --- a/src/sage/plot/plot3d/plot_field3d.py +++ b/src/sage/plot/plot3d/plot_field3d.py @@ -126,9 +126,9 @@ def plot_vector_field3d(functions, xrange, yrange, zrange, vectors = [vector((ff(*point), gg(*point), hh(*point))) for point in points] try: - from matplotlib.cm import get_cmap - cm = get_cmap(colors) - except (TypeError, ValueError): + import matplotlib as mpl + cm = mpl.colormaps[colors] + except (TypeError, KeyError): cm = None if cm is None: if isinstance(colors, (list, tuple)):