@@ -24,7 +24,7 @@ module fortplot_figure_render_engine
2424use fortplot_pdf_coordinate, only: calculate_pdf_plot_area
2525use fortplot_png, only: png_context
2626use fortplot_pdf, only: pdf_context
27- use fortplot_ascii, only: ascii_context
27+ use fortplot_ascii, only: ascii_context, ASCII_CHAR_ASPECT
2828implicit none
2929
3030private
@@ -82,6 +82,7 @@ subroutine render_single_axis(state, plots, plot_count, annotations, annotation_
8282logical :: have_pie_pixels
8383logical :: has_pie_plots
8484logical :: pie_only
85+ logical :: ascii_backend
8586
8687call 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+
97105if (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.
147156if (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
163173end select
164174
@@ -177,7 +187,8 @@ subroutine render_single_axis(state, plots, plot_count, annotations, annotation_
177187call render_figure_background(state% backend)
178188
179189if (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
191203end if
192204
193205if (.not. pie_only)then