擅长:python、mysql、java
<p>此参数被定义为<code>'stroke-miterlimit': '100000'</code>,并且是在后端硬设置的_svg.py. matplotlibrc中没有这样的参数,因此不可能使用样式表进行自定义。在</p>
<p>我使用以下代码修复此问题:</p>
<pre><code>def fixmiterlimit(svgdata, miterlimit = 10):
# miterlimit variable sets the desired miterlimit
mlfound = False
svgout = ""
for line in svgdata:
if not mlfound:
# searches the stroke-miterlimit within the current line and changes its value
mlstring = re.subn(r'stroke-miterlimit:([0-9]+)', "stroke-miterlimit:" + str(miterlimit), line)
if mlstring[1]: # use number of changes made to the line to check whether anything was found
mlfound = True
svgout += mlstring[0] + '\n'
else:
svgout += line + '\n'
else:
svgout += line + '\n'
return svgout
</code></pre>
<p>然后这样称呼它(使用这个<a href="https://stackoverflow.com/questions/5453375/matplotlib-svg-as-string-and-not-a-file?rq=1">post</a>的技巧):</p>
^{pr2}$
<p>基本上,在写入SVG文件之前,先将stroke参数写入SVG文件。为我工作。在</p>