Skip to content

Commit e4a0b7f

Browse files
committed
Fix PDF contour horizontal lines - use fill and stroke
- Changed from 'f*' (fill only) to 'B' (fill and stroke) operator - Stroke color matches fill color, eliminating anti-aliasing gaps - Follows matplotlib technique: set_edgecolor('face') - Completely eliminates horizontal lines in contour plots - Fixes final issue in #1413 The 'B' operator fills and strokes with the same color, covering the sub-pixel gaps that appear when PDF viewers anti-alias adjacent polygons.
1 parent cd66d08 commit e4a0b7f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backends/vector/fortplot_pdf.f90

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,14 +355,16 @@ subroutine fill_quad_wrapper(this, x_quad, y_quad)
355355
write (cmd, '(F0.3,1X,F0.3)') maxx + eps, maxy + eps; call this%stream_writer%add_to_stream(trim(cmd)//' l')
356356
write (cmd, '(F0.3,1X,F0.3)') minx - eps, maxy + eps; call this%stream_writer%add_to_stream(trim(cmd)//' l')
357357
call this%stream_writer%add_to_stream('h')
358-
call this%stream_writer%add_to_stream('f*')
358+
! Use 'B' (fill and stroke) instead of 'f*' to eliminate anti-aliasing gaps
359+
call this%stream_writer%add_to_stream('B')
359360
else
360361
write (cmd, '(F0.3,1X,F0.3)') px(1), py(1); call this%stream_writer%add_to_stream(trim(cmd)//' m')
361362
write (cmd, '(F0.3,1X,F0.3)') px(2), py(2); call this%stream_writer%add_to_stream(trim(cmd)//' l')
362363
write (cmd, '(F0.3,1X,F0.3)') px(3), py(3); call this%stream_writer%add_to_stream(trim(cmd)//' l')
363364
write (cmd, '(F0.3,1X,F0.3)') px(4), py(4); call this%stream_writer%add_to_stream(trim(cmd)//' l')
364365
call this%stream_writer%add_to_stream('h')
365-
call this%stream_writer%add_to_stream('f*')
366+
! Use 'B' (fill and stroke) instead of 'f*' to eliminate anti-aliasing gaps
367+
call this%stream_writer%add_to_stream('B')
366368
end if
367369
end subroutine fill_quad_wrapper
368370

0 commit comments

Comments
 (0)