Skip to content

Fix #4335: mathtext whitespacing commands #4402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/matplotlib/_mathtext_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1946,7 +1946,6 @@
'boxminus' : 8863,
'equiv' : 8801,
'Lleftarrow' : 8666,
'thinspace' : 8201,
'll' : 8810,
'Cup' : 8915,
'measeq' : 8798,
Expand Down Expand Up @@ -2169,7 +2168,6 @@
'cdots' : 8943,
'hat' : 770,
'eqgtr' : 8925,
'enspace' : 8194,
'psi' : 968,
'frown' : 8994,
'acute' : 769,
Expand Down
5 changes: 4 additions & 1 deletion lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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
-------

Expand Down
46 changes: 23 additions & 23 deletions lib/matplotlib/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,36 +683,37 @@ 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()
if len(tpath.vertices):
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()
Expand Down Expand Up @@ -772,7 +773,6 @@ def draw(self, renderer):

gc.restore()

gc.restore()
renderer.close_group('line2d')

def get_antialiased(self):
Expand Down
19 changes: 12 additions & 7 deletions lib/matplotlib/mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading