Michael Droettboom <md...@stsci.edu>
writes:

> Passing solid_joinstyle='bevel' does resolve the problem on both 0.91.x 
> and 0.98.x.  Additionally, path simplification (which is a new feature 
> on 0.98.x) also resolves this problem (set rcParam path.simplify to True).

It seems that agg and pdf have different ways to render small angles
when the join style is 'miter'. Pdf has a limit (settable in the pdf
file) beyond which it reverts to bevel-style angles, agg seems to always
do the miter join but cuts it off at some distance.

Here's a test script, and screenshots of (a part of) the agg and pdf
outputs when the join style is 'miter'.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks

#!/usr/bin/env python

import numpy as np
import matplotlib
import pylab

def plot_angle(ax, x, y, angle, style):
    phi = angle/180*np.pi
    xx = [x+.5,x,x+.5*np.cos(phi)]
    yy = [y,y,y+.5*np.sin(phi)]
    ax.plot(xx, yy, lw=8, color='blue', solid_joinstyle=style)
    ax.plot(xx[1:], yy[1:], lw=1, color='black')
    ax.plot(xx[1::-1], yy[1::-1], lw=1, color='black')
    ax.plot(xx[1:2], yy[1:2], 'o', color='red', markersize=3)
    ax.text(x,y+.2,'%.0f degrees' % angle)

for style in ('miter', 'round', 'bevel'):
    fig = pylab.figure()
    ax = fig.add_subplot(111)
    for i in range(16):
        plot_angle(ax, i%4, i//4, i+1., style)
    ax.set_xlim(-.5,4)
    ax.set_ylim(-.5,4)
    fig.savefig('joinstyle_'+style+'.png', dpi=150)
    fig.savefig('joinstyle_'+style+'.pdf')

<<inline: agg_miter.png>>

<<inline: pdf_miter.png>>

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to