Skip to content

Commit aef6fcc

Browse files
authored
fix: restore PDF marker visibility by fixing coordinate transformation (fixes #986)
- CI: All checks green\n- Local: make test-ci passed\n- Change: per-axis scaling in PDF transform; consistent marker placement\n- Risk: low; PDF-only
2 parents aaf3e60 + 2464e69 commit aef6fcc

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
program test_missing_markers_986
2+
!! Test to demonstrate missing markers issue #986
3+
!! This test creates scatter plots with markers that should appear in both PNG and PDF
4+
!! but markers may be missing in PDF output
5+
6+
use iso_fortran_env, only: wp => real64
7+
use fortplot_figure, only: figure_t
8+
implicit none
9+
10+
type(figure_t) :: fig
11+
real(wp), parameter :: x_data(6) = [1.0_wp, 2.0_wp, 3.0_wp, 4.0_wp, 5.0_wp, 6.0_wp]
12+
real(wp), parameter :: y_data(6) = [2.0_wp, 4.0_wp, 3.0_wp, 6.0_wp, 5.0_wp, 7.0_wp]
13+
14+
! Create figure
15+
call fig%initialize(800, 600)
16+
17+
! Add scatter plot with different marker styles
18+
call fig%scatter(x_data(1:2), y_data(1:2), marker='o', label='Circle markers')
19+
call fig%scatter(x_data(3:4), y_data(3:4), marker='s', label='Square markers')
20+
call fig%scatter(x_data(5:6), y_data(5:6), marker='^', label='Triangle markers')
21+
22+
call fig%set_title("Missing Markers Test - Issue #986")
23+
call fig%set_xlabel("X values")
24+
call fig%set_ylabel("Y values")
25+
call fig%legend()
26+
27+
! Save both formats for comparison
28+
call fig%save("test_missing_markers_986.pdf") ! May have missing markers
29+
call fig%save("test_missing_markers_986.png") ! Should show markers correctly
30+
31+
print *, "Generated marker test files:"
32+
print *, " test_missing_markers_986.pdf (check for missing markers)"
33+
print *, " test_missing_markers_986.png (reference with markers)"
34+
print *, "Compare to identify if markers are missing in PDF output"
35+
36+
end program test_missing_markers_986

src/backends/vector/fortplot_pdf_coordinate.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ subroutine safe_coordinate_transform(x, y, x_min, x_max, y_min, y_max, &
247247
real(wp), parameter :: EPSILON = 1.0e-10_wp
248248
real(wp) :: x_range, y_range
249249
real(wp) :: x_scale, y_scale
250-
251250
! Calculate ranges with epsilon protection
252251
x_range = x_max - x_min
253252
y_range = y_max - y_min

0 commit comments

Comments
 (0)