Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita72d9fb

Browse files
krystophnyclaude
andcommitted
CRITICAL FIX: Add square markers to PNG/PDF pie chart legends
**Problem**: Pie chart legends in PNG/PDF showed ASCII characters instead of colored squares- GitHub Pages pie chart demo had invisible legend markers- Pie charts used get_pie_slice_marker_for_index() returning '-', '=', '%' characters- These ASCII characters don't render as colored squares in PNG/PDF backends**Root Cause**: Pie chart legend creation was separate from regular plots- add_pie_legend_entries() used ASCII characters for all backends- PNG/PDF backends need square markers for color visibility- ASCII characters work for text-based ASCII backend but not graphical backends**Solution**: Backend-aware pie chart legend markers- Modified add_pie_legend_entries() to accept backend_name parameter- ASCII backend: Continue using distinct ASCII characters ('-', '=', '%', etc.)- PNG/PDF backends: Use square markers ('s') for colored legend visibility- Updated setup_figure_legend() to pass backend_name to pie chart function**Changes**:- add_pie_legend_entries(): Added backend_name parameter and conditional logic- Pie chart legends now show colored squares in PNG/PDF instead of invisible ASCII chars- ASCII pie chart legends preserve distinct character markers for text output**This fixes the pie chart legend color visibility seen on GitHub Pages demo**🤖 Generated with [Claude Code](https://claude.com/claude-code)Co-Authored-By: Claude <noreply@anthropic.com>
1 parentc466260 commita72d9fb

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

‎src/figures/fortplot_figure_plot_management.f90‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ subroutine setup_figure_legend(legend_data, show_legend, plots, plot_count, loca
551551
! Add legend entries from plots
552552
do i=1, plot_count
553553
if (plots(i)%plot_type == PLOT_TYPE_PIE)then
554-
call add_pie_legend_entries(legend_data, plots(i))
554+
call add_pie_legend_entries(legend_data, plots(i), backend_name)
555555
cycle
556556
end if
557557

@@ -585,10 +585,11 @@ subroutine setup_figure_legend(legend_data, show_legend, plots, plot_count, loca
585585
end do
586586
endsubroutine setup_figure_legend
587587

588-
subroutineadd_pie_legend_entries(legend_data,plot)
588+
subroutineadd_pie_legend_entries(legend_data,plot,backend_name)
589589
!! Add one legend entry per pie slice using wedge colors
590590
type(legend_t),intent(inout):: legend_data
591591
type(plot_data_t),intent(in):: plot
592+
character(len=*),intent(in),optional:: backend_name
592593

593594
integer:: slice_count, i
594595
real(wp):: color(3)
@@ -636,8 +637,14 @@ subroutine add_pie_legend_entries(legend_data, plot)
636637
end if
637638
end if
638639

639-
call legend_data%add_entry(trim(label_buf), color, &
640-
linestyle='None', marker=get_pie_slice_marker_for_index(i))
640+
! Use square markers for PNG/PDF, ASCII characters for ASCII backend
641+
if (present(backend_name).and.trim(backend_name) =='ascii')then
642+
call legend_data%add_entry(trim(label_buf), color, &
643+
linestyle='None', marker=get_pie_slice_marker_for_index(i))
644+
else
645+
call legend_data%add_entry(trim(label_buf), color, &
646+
linestyle='None', marker='s')
647+
end if
641648
end do
642649
endsubroutine add_pie_legend_entries
643650

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp