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

Commit1e0162b

Browse files
committed
fix: balance ascii pie aspect and disable grid
1 parentda3c3cd commit1e0162b

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

‎src/backends/ascii/fortplot_ascii.f90‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ module fortplot_ascii
2626
implicit none
2727

2828
private
29-
public:: ascii_context, create_ascii_canvas
29+
public:: ascii_context, create_ascii_canvas, ASCII_CHAR_ASPECT
30+
31+
real(wp),parameter:: ASCII_CHAR_ASPECT=2.0_wp
3032

3133
real(wp),parameter:: ASCII_CHAR_ASPECT=2.0_wp
3234

‎src/figures/management/fortplot_figure_render_engine.f90‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module fortplot_figure_render_engine
2424
use fortplot_pdf_coordinate, only: calculate_pdf_plot_area
2525
use fortplot_png, only: png_context
2626
use fortplot_pdf, only: pdf_context
27-
use fortplot_ascii, only: ascii_context
27+
use fortplot_ascii, only: ascii_context, ASCII_CHAR_ASPECT
2828
implicit none
2929

3030
private
@@ -82,6 +82,7 @@ subroutine render_single_axis(state, plots, plot_count, annotations, annotation_
8282
logical:: have_pie_pixels
8383
logical:: has_pie_plots
8484
logical:: pie_only
85+
logical:: ascii_backend
8586

8687
call calculate_figure_data_ranges(plots, plot_count, &
8788
state%xlim_set, state%ylim_set, &
@@ -94,6 +95,13 @@ subroutine render_single_axis(state, plots, plot_count, annotations, annotation_
9495
state%xscale, state%yscale, &
9596
state%symlog_threshold, axis_filter=AXIS_PRIMARY)
9697

98+
ascii_backend=.false.
99+
selecttype (backend_ptr=> state%backend)
100+
class is (ascii_context)
101+
ascii_backend=.true.
102+
class default
103+
end select
104+
97105
if (state%has_twinx)then
98106
x_min_dummy= state%x_min
99107
x_max_dummy= state%x_max
@@ -144,6 +152,7 @@ subroutine render_single_axis(state, plots, plot_count, annotations, annotation_
144152

145153
has_pie_plots= contains_pie_plot(plots, plot_count)
146154
pie_only=.false.
155+
ascii_backend=.false.
147156
if (has_pie_plots)then
148157
have_pie_pixels=.false.
149158
selecttype (bk=> state%backend)
@@ -157,8 +166,9 @@ subroutine render_single_axis(state, plots, plot_count, annotations, annotation_
157166
have_pie_pixels=.true.
158167
class is (ascii_context)
159168
pie_plot_width_px=real(max(1, bk%plot_width-3), wp)
160-
pie_plot_height_px=real(max(1, bk%plot_height-3), wp)
169+
pie_plot_height_px=real(max(1, bk%plot_height-3), wp)* ASCII_CHAR_ASPECT
161170
have_pie_pixels=.true.
171+
ascii_backend=.true.
162172
class default
163173
end select
164174

@@ -177,7 +187,8 @@ subroutine render_single_axis(state, plots, plot_count, annotations, annotation_
177187
call render_figure_background(state%backend)
178188

179189
if (state%grid_enabled)then
180-
call render_grid_lines(state%backend, state%grid_enabled, &
190+
if (.not. ascii_backend)then
191+
call render_grid_lines(state%backend, state%grid_enabled, &
181192
state%grid_which, state%grid_axis, &
182193
state%grid_alpha, state%width, state%height, &
183194
state%margin_left, state%margin_right, &
@@ -188,6 +199,7 @@ subroutine render_single_axis(state, plots, plot_count, annotations, annotation_
188199
state%x_min_transformed, state%x_max_transformed, &
189200
state%y_min_transformed, state%y_max_transformed, &
190201
state%grid_linestyle)
202+
end if
191203
end if
192204

193205
if (.not. pie_only)then

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp