Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions BACKLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@


**🚨 CRITICAL: CI test suite failures - user-visible rendering broken**
- [ ] #401: Fix - CI test-coverage failing with segfaults in colored_contours and ascii_heatmap_demo (blocks all PR merges)

**🚨 CRITICAL: User-visible PNG/PDF rendering regressions**

**User-Facing Issues (Medium Priority)**
- [ ] #377: Enhancement - make finer grid on pcolormesh_demo.html (enhancement)
*All user-facing issues moved to DOING*

**Infrastructure & Documentation Issues (Lower Priority)**
- [ ] #388: Fix - investigate test_mpeg_consolidated failure unrelated to ylabel rotation (test infrastructure)

## DOING (Current Work)
*No current work - ready for next task*
- [x] #377: Enhancement - make finer grid on pcolormesh_demo.html (branch: enhance-finer-grid-377)

## FUTURE SPRINTS - Systematic Restoration

Expand Down
96 changes: 55 additions & 41 deletions example/fortran/pcolormesh_demo/pcolormesh_demo.f90
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,33 @@ program pcolormesh_demo
contains

subroutine demo_basic_gradient()
!! Basic pcolormesh with simple gradient
real(wp) :: x(6), y(5)
real(wp) :: c(4, 5)
!! Basic pcolormesh with simple gradient - enhanced 51x51 grid
real(wp) :: x(51), y(51)
real(wp) :: c(50, 50)
integer :: i, j
real(wp) :: dx, dy

! Create coordinate arrays for regular grid
do i = 1, 6
x(i) = real(i-1, wp) * 0.4_wp
! Create coordinate arrays for high-resolution regular grid
dx = 2.0_wp / 50.0_wp ! Total range 2.0, 50 intervals
dy = 1.2_wp / 50.0_wp ! Total range 1.2, 50 intervals

do i = 1, 51
x(i) = real(i-1, wp) * dx
end do
do i = 1, 5
y(i) = real(i-1, wp) * 0.3_wp
do i = 1, 51
y(i) = real(i-1, wp) * dy
end do

! Create test data - simple gradient
do i = 1, 4
do j = 1, 5
c(i, j) = real(i, wp) + real(j, wp) * 0.5_wp
! Create test data - smooth gradient across high-res grid
do i = 1, 50
do j = 1, 50
c(i, j) = real(i, wp) / 50.0_wp + real(j, wp) / 50.0_wp * 0.5_wp
end do
end do

! Create pcolormesh plot
call figure(figsize=[6.4_wp, 4.8_wp])
call title('Basic Pcolormesh - Linear Gradient')
call title('Basic Pcolormesh - Linear Gradient (50x50 resolution)')
call xlabel('X coordinate')
call ylabel('Y coordinate')
call pcolormesh(x, y, c, colormap='viridis')
Expand All @@ -45,32 +49,36 @@ subroutine demo_basic_gradient()
end subroutine demo_basic_gradient

subroutine demo_sinusoidal_pattern()
!! Pcolormesh with sinusoidal pattern
real(wp) :: x(9), y(9)
real(wp) :: c(8, 8)
!! Pcolormesh with sinusoidal pattern - enhanced 51x51 grid
real(wp) :: x(51), y(51)
real(wp) :: c(50, 50)
real(wp) :: xi, yj
integer :: i, j
real(wp), parameter :: pi = 3.14159265359_wp
real(wp) :: dx, dy

! Create coordinate arrays for high-resolution grid
dx = 1.6_wp / 50.0_wp ! Total range 1.6, 50 intervals
dy = 1.2_wp / 50.0_wp ! Total range 1.2, 50 intervals

! Create coordinate arrays
do i = 1, 9
x(i) = real(i-1, wp) * 0.2_wp
do i = 1, 51
x(i) = real(i-1, wp) * dx
end do
do i = 1, 9
y(i) = real(i-1, wp) * 0.15_wp
do i = 1, 51
y(i) = real(i-1, wp) * dy
end do

! Create sinusoidal pattern
do i = 1, 8
do j = 1, 8
xi = (x(i) + x(i+1)) * 0.5_wp ! Center of quad
yj = (y(j) + y(j+1)) * 0.5_wp ! Center of quad
! Create sinusoidal pattern with proper sampling
do i = 1, 50
do j = 1, 50
xi = (x(i) + x(i+1)) * 0.5_wp ! Center of cell
yj = (y(j) + y(j+1)) * 0.5_wp ! Center of cell
c(i, j) = sin(2.0_wp * pi * xi) * cos(3.0_wp * pi * yj)
end do
end do

call figure(figsize=[6.4_wp, 4.8_wp])
call title('Pcolormesh - Sinusoidal Pattern')
call title('Pcolormesh - Sinusoidal Pattern (50x50 resolution)')
call xlabel('X coordinate')
call ylabel('Y coordinate')
call pcolormesh(x, y, c, colormap='coolwarm')
Expand All @@ -81,31 +89,37 @@ subroutine demo_sinusoidal_pattern()
end subroutine demo_sinusoidal_pattern

subroutine demo_different_colormaps()
!! Demo different colormaps
real(wp) :: x(6), y(6)
real(wp) :: c(5, 5)
real(wp) :: r
!! Demo different colormaps - enhanced 51x51 grid
real(wp) :: x(51), y(51)
real(wp) :: c(50, 50)
real(wp) :: r, xi, yj
integer :: i, j
real(wp), parameter :: pi = 3.14159265359_wp
real(wp) :: dx, dy

! Create coordinate arrays for high-resolution grid
dx = 1.5_wp / 50.0_wp ! Total range 1.5, 50 intervals
dy = 1.25_wp / 50.0_wp ! Total range 1.25, 50 intervals

! Create coordinate arrays
do i = 1, 6
x(i) = real(i-1, wp) * 0.3_wp
do i = 1, 51
x(i) = real(i-1, wp) * dx
end do
do i = 1, 6
y(i) = real(i-1, wp) * 0.25_wp
do i = 1, 51
y(i) = real(i-1, wp) * dy
end do

! Create radial pattern
do i = 1, 5
do j = 1, 5
r = sqrt((x(i) - 1.0_wp)**2 + (y(j) - 0.6_wp)**2)
! Create radial pattern with proper sampling
do i = 1, 50
do j = 1, 50
xi = (x(i) + x(i+1)) * 0.5_wp ! Center of cell
yj = (y(j) + y(j+1)) * 0.5_wp ! Center of cell
r = sqrt((xi - 0.75_wp)**2 + (yj - 0.625_wp)**2)
c(i, j) = exp(-r)
end do
end do

call figure(figsize=[6.4_wp, 4.8_wp])
call title('Pcolormesh - Radial Pattern (Plasma)')
call title('Pcolormesh - Radial Pattern (Plasma) (50x50 resolution)')
call xlabel('X coordinate')
call ylabel('Y coordinate')
call pcolormesh(x, y, c, colormap='plasma')
Expand Down
46 changes: 32 additions & 14 deletions src/fortplot_matplotlib.f90
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,22 @@ subroutine pcolormesh(x, y, z, shading, colormap, show_colorbar, label, &
wp_linewidths = real(linewidths, wp)
end if

! Forward SUPPORTED parameters to underlying method using single call pattern
call fig%add_pcolormesh(wp_x, wp_y, wp_z, &
colormap=merge(colormap, "", present(colormap)), &
vmin=merge(wp_vmin, 0.0_wp, present(vmin)), &
vmax=merge(wp_vmax, 0.0_wp, present(vmax)), &
edgecolors=merge(wp_edgecolors, [0.0_wp, 0.0_wp, 0.0_wp], present(edgecolors)), &
linewidths=merge(wp_linewidths, 0.0_wp, present(linewidths)))
! Forward SUPPORTED parameters to underlying method using conditional calls
if (present(colormap) .and. present(vmin) .and. present(vmax) .and. &
present(edgecolors) .and. present(linewidths)) then
call fig%add_pcolormesh(wp_x, wp_y, wp_z, &
colormap=colormap, vmin=wp_vmin, vmax=wp_vmax, &
edgecolors=wp_edgecolors, linewidths=wp_linewidths)
else if (present(colormap) .and. present(vmin) .and. present(vmax)) then
call fig%add_pcolormesh(wp_x, wp_y, wp_z, &
colormap=colormap, vmin=wp_vmin, vmax=wp_vmax)
else if (present(colormap)) then
call fig%add_pcolormesh(wp_x, wp_y, wp_z, colormap=colormap)
else if (present(vmin) .and. present(vmax)) then
call fig%add_pcolormesh(wp_x, wp_y, wp_z, vmin=wp_vmin, vmax=wp_vmax)
else
call fig%add_pcolormesh(wp_x, wp_y, wp_z)
end if

deallocate(wp_x, wp_y, wp_z)
end subroutine pcolormesh
Expand Down Expand Up @@ -472,13 +481,22 @@ subroutine add_pcolormesh(x, y, z, shading, colormap, show_colorbar, label, &
wp_linewidths = real(linewidths, wp)
end if

! Forward SUPPORTED parameters to underlying method using single call pattern
call fig%add_pcolormesh(wp_x, wp_y, wp_z, &
colormap=merge(colormap, "", present(colormap)), &
vmin=merge(wp_vmin, 0.0_wp, present(vmin)), &
vmax=merge(wp_vmax, 0.0_wp, present(vmax)), &
edgecolors=merge(wp_edgecolors, [0.0_wp, 0.0_wp, 0.0_wp], present(edgecolors)), &
linewidths=merge(wp_linewidths, 0.0_wp, present(linewidths)))
! Forward SUPPORTED parameters to underlying method using conditional calls
if (present(colormap) .and. present(vmin) .and. present(vmax) .and. &
present(edgecolors) .and. present(linewidths)) then
call fig%add_pcolormesh(wp_x, wp_y, wp_z, &
colormap=colormap, vmin=wp_vmin, vmax=wp_vmax, &
edgecolors=wp_edgecolors, linewidths=wp_linewidths)
else if (present(colormap) .and. present(vmin) .and. present(vmax)) then
call fig%add_pcolormesh(wp_x, wp_y, wp_z, &
colormap=colormap, vmin=wp_vmin, vmax=wp_vmax)
else if (present(colormap)) then
call fig%add_pcolormesh(wp_x, wp_y, wp_z, colormap=colormap)
else if (present(vmin) .and. present(vmax)) then
call fig%add_pcolormesh(wp_x, wp_y, wp_z, vmin=wp_vmin, vmax=wp_vmax)
else
call fig%add_pcolormesh(wp_x, wp_y, wp_z)
end if

deallocate(wp_x, wp_y, wp_z)
end subroutine add_pcolormesh
Expand Down
Loading
Loading