Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit aa35ec4

Browse filesBrowse files
authored
Merge pull request #13758 from meeseeksmachine/auto-backport-of-pr-13674-on-v3.1.x
Backport PR #13674 on branch v3.1.x (Preserve whitespace in svg output.)
2 parents a65a91e + bd78692 commit aa35ec4
Copy full SHA for aa35ec4

File tree

Expand file treeCollapse file tree

3 files changed

+34
-1
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+34
-1
lines changed

‎lib/matplotlib/backends/backend_svg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_svg.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,9 @@ def _write_default_style(self):
317317
writer = self.writer
318318
default_style = generate_css({
319319
'stroke-linejoin': 'round',
320-
'stroke-linecap': 'butt'})
320+
'stroke-linecap': 'butt',
321+
'white-space': 'pre',
322+
})
321323
writer.start('defs')
322324
writer.start('style', type='text/css')
323325
writer.data('*{%s}\n' % default_style)
+24Lines changed: 24 additions & 0 deletions
Loading

‎lib/matplotlib/tests/test_backend_svg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backend_svg.py
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ def test_text_urls():
7676
assert expected in buf
7777

7878

79+
@image_comparison(baseline_images=['white_space_pre'], extensions=['svg'])
80+
def test_white_space_pre():
81+
plt.rcParams["svg.fonttype"] = "none"
82+
fig = plt.figure()
83+
fig.text(.5, .5, "a b c")
84+
85+
7986
@image_comparison(baseline_images=['bold_font_output'], extensions=['svg'])
8087
def test_bold_font_output():
8188
fig = plt.figure()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.