diff --git a/lib/matplotlib/_mathtext_data.py b/lib/matplotlib/_mathtext_data.py index 9354c71dc330..d564c7265526 100644 --- a/lib/matplotlib/_mathtext_data.py +++ b/lib/matplotlib/_mathtext_data.py @@ -1946,7 +1946,6 @@ 'boxminus' : 8863, 'equiv' : 8801, 'Lleftarrow' : 8666, - 'thinspace' : 8201, 'll' : 8810, 'Cup' : 8915, 'measeq' : 8798, @@ -2169,7 +2168,6 @@ 'cdots' : 8943, 'hat' : 770, 'eqgtr' : 8925, - 'enspace' : 8194, 'psi' : 968, 'frown' : 8994, 'acute' : 769, diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 7bde86496ef3..75980d177f08 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2602,7 +2602,7 @@ def errorbar(self, x, y, yerr=None, xerr=None, before :meth:`errorbar`. *errorevery*: positive integer - subsamples the errorbars. e.g., if everyerror=5, errorbars for + subsamples the errorbars. e.g., if errorevery=5, errorbars for every 5-th datapoint will be plotted. The data plot itself still shows all data points. @@ -3026,6 +3026,9 @@ def boxplot(self, x, notch=False, sym=None, vert=True, whis=1.5, *meanprops*. Not recommended if *shownotches* is also True. Otherwise, means will be shown as points. + manage_xticks : bool, default = True + If the function should adjust the xlim and xtick locations. + Returns ------- diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index f588dcf8fbbf..66a480d53116 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -683,28 +683,6 @@ def draw(self, renderer): renderer = PathEffectRenderer(self.get_path_effects(), renderer) renderer.open_group('line2d', self.get_gid()) - gc = renderer.new_gc() - self._set_gc_clip(gc) - - ln_color_rgba = self._get_rgba_ln_color() - gc.set_foreground(ln_color_rgba, isRGBA=True) - gc.set_alpha(ln_color_rgba[3]) - - gc.set_antialiased(self._antialiased) - gc.set_linewidth(self._linewidth) - - if self.is_dashed(): - cap = self._dashcapstyle - join = self._dashjoinstyle - else: - cap = self._solidcapstyle - join = self._solidjoinstyle - gc.set_joinstyle(join) - gc.set_capstyle(cap) - gc.set_snap(self.get_snap()) - if self.get_sketch_params() is not None: - gc.set_sketch_params(*self.get_sketch_params()) - funcname = self._lineStyles.get(self._linestyle, '_draw_nothing') if funcname != '_draw_nothing': tpath, affine = transf_path.get_transformed_path_and_affine() @@ -712,7 +690,30 @@ def draw(self, renderer): self._lineFunc = getattr(self, funcname) funcname = self.drawStyles.get(self._drawstyle, '_draw_lines') drawFunc = getattr(self, funcname) + gc = renderer.new_gc() + self._set_gc_clip(gc) + + ln_color_rgba = self._get_rgba_ln_color() + gc.set_foreground(ln_color_rgba, isRGBA=True) + gc.set_alpha(ln_color_rgba[3]) + + gc.set_antialiased(self._antialiased) + gc.set_linewidth(self._linewidth) + + if self.is_dashed(): + cap = self._dashcapstyle + join = self._dashjoinstyle + else: + cap = self._solidcapstyle + join = self._solidjoinstyle + gc.set_joinstyle(join) + gc.set_capstyle(cap) + gc.set_snap(self.get_snap()) + if self.get_sketch_params() is not None: + gc.set_sketch_params(*self.get_sketch_params()) + drawFunc(renderer, gc, tpath, affine.frozen()) + gc.restore() if self._marker: gc = renderer.new_gc() @@ -772,7 +773,6 @@ def draw(self, renderer): gc.restore() - gc.restore() renderer.close_group('line2d') def get_antialiased(self): diff --git a/lib/matplotlib/mathtext.py b/lib/matplotlib/mathtext.py index 6ff3b4445e6c..e3da2e4d24ee 100644 --- a/lib/matplotlib/mathtext.py +++ b/lib/matplotlib/mathtext.py @@ -2431,13 +2431,18 @@ def _make_space(self, percentage): self._em_width_cache[key] = width return Kern(width * percentage) - _space_widths = { r'\ ' : 0.3, - r'\,' : 0.4, - r'\;' : 0.8, - r'\quad' : 1.6, - r'\qquad' : 3.2, - r'\!' : -0.4, - r'\/' : 0.4 } + _space_widths = { r'\,' : 0.16667, # 3/18 em = 3 mu + r'\thinspace' : 0.16667, # 3/18 em = 3 mu + r'\/' : 0.16667, # 3/18 em = 3 mu + r'\>' : 0.22222, # 4/18 em = 4 mu + r'\:' : 0.22222, # 4/18 em = 4 mu + r'\;' : 0.27778, # 5/18 em = 5 mu + r'\ ' : 0.33333, # 6/18 em = 6 mu + r'\enspace' : 0.5, # 9/18 em = 9 mu + r'\quad' : 1, # 1 em = 18 mu + r'\qquad' : 2, # 2 em = 36 mu + r'\!' : -0.16667, # -3/18 em = -3 mu + } def space(self, s, loc, toks): assert(len(toks)==1) num = self._space_widths[toks[0]] diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_70.pdf b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_70.pdf new file mode 100644 index 000000000000..7bb1e1a9d190 Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_70.pdf differ diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_70.png b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_70.png new file mode 100644 index 000000000000..55986a513061 Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_70.png differ diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_70.svg b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_70.svg new file mode 100644 index 000000000000..ea4591841c6d --- /dev/null +++ b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_70.svg @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_70.pdf b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_70.pdf new file mode 100644 index 000000000000..0cef8edf4c97 Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_70.pdf differ diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_70.png b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_70.png new file mode 100644 index 000000000000..4c8eeab5035c Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_70.png differ diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_70.svg b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_70.svg new file mode 100644 index 000000000000..7c4e65dc5827 --- /dev/null +++ b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_70.svg @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_70.pdf b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_70.pdf new file mode 100644 index 000000000000..40eed4df1063 Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_70.pdf differ diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_70.png b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_70.png new file mode 100644 index 000000000000..2c86c67da769 Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_70.png differ diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_70.svg b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_70.svg new file mode 100644 index 000000000000..603294c36659 --- /dev/null +++ b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_70.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/mpl_toolkits/axes_grid1/axes_grid.py b/lib/mpl_toolkits/axes_grid1/axes_grid.py index 778e8fd2204b..6d90c090e011 100644 --- a/lib/mpl_toolkits/axes_grid1/axes_grid.py +++ b/lib/mpl_toolkits/axes_grid1/axes_grid.py @@ -5,7 +5,6 @@ import matplotlib.cbook as cbook -import matplotlib.pyplot as plt import matplotlib.axes as maxes #import matplotlib.colorbar as mcolorbar from . import colorbar as mcolorbar @@ -807,94 +806,3 @@ def _update_locators(self): AxesGrid = ImageGrid -#if __name__ == "__main__": -if 0: - F = plt.figure(1, (7, 6)) - F.clf() - - F.subplots_adjust(left=0.15, right=0.9) - - grid = Grid(F, 111, # similar to subplot(111) - nrows_ncols=(2, 2), - direction="row", - axes_pad = 0.05, - add_all=True, - label_mode = "1", - ) - -#if __name__ == "__main__": -if 0: - from .axes_divider import get_demo_image - F = plt.figure(1, (9, 3.5)) - F.clf() - - F.subplots_adjust(left=0.05, right=0.98) - - grid = ImageGrid(F, 131, # similar to subplot(111) - nrows_ncols=(2, 2), - direction="row", - axes_pad = 0.05, - add_all=True, - label_mode = "1", - ) - - Z, extent = get_demo_image() - plt.ioff() - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest") - - # This only affects axes in - # first column and second row as share_all = False. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - plt.ion() - - grid = ImageGrid(F, 132, # similar to subplot(111) - nrows_ncols=(2, 2), - direction="row", - axes_pad = 0.0, - add_all=True, - share_all=True, - label_mode = "1", - cbar_mode="single", - ) - - Z, extent = get_demo_image() - plt.ioff() - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest") - plt.colorbar(im, cax=grid.cbar_axes[0]) - plt.setp(grid.cbar_axes[0].get_yticklabels(), visible=False) - - # This affects all axes as share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - plt.ion() - - grid = ImageGrid(F, 133, # similar to subplot(122) - nrows_ncols=(2, 2), - direction="row", - axes_pad = 0.1, - add_all=True, - label_mode = "1", - share_all = True, - cbar_location="top", - cbar_mode="each", - cbar_size="7%", - cbar_pad="2%", - ) - plt.ioff() - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest") - plt.colorbar(im, cax=grid.cbar_axes[i], - orientation="horizontal") - grid.cbar_axes[i].xaxis.set_ticks_position("top") - plt.setp(grid.cbar_axes[i].get_xticklabels(), visible=False) - - # This affects all axes as share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - plt.ion() - plt.draw()