fortplot_figure_aspect Module

Helper routines for enforcing axis aspect ratios in figures



Functions

public function contains_pie_plot(plots, plot_count) result(has_pie)

Detect whether a collection of plots contains at least one pie chart

Arguments

Type IntentOptional Attributes Name
type(plot_data_t), intent(in) :: plots(:)
integer, intent(in) :: plot_count

Return Value logical

public function only_pie_plots(plots, plot_count) result(all_pie)

Check if every plot in the collection is a pie chart

Arguments

Type IntentOptional Attributes Name
type(plot_data_t), intent(in) :: plots(:)
integer, intent(in) :: plot_count

Return Value logical


Subroutines

public subroutine enforce_pie_axis_equal(state, plot_width_px, plot_height_px)

Adjust the figure axis limits so pie charts render with equal scaling

Arguments

Type IntentOptional Attributes Name
type(figure_state_t), intent(inout) :: state
real(kind=wp), intent(in), optional :: plot_width_px
real(kind=wp), intent(in), optional :: plot_height_px

public subroutine enforce_aspect_ratio(state, plot_width_px, plot_height_px)

Arguments

Type IntentOptional Attributes Name
type(figure_state_t), intent(inout) :: state
real(kind=wp), intent(in) :: plot_width_px
real(kind=wp), intent(in) :: plot_height_px

public subroutine equalize_aspect_limits(aspect_mode, aspect_ratio, plot_width_px, plot_height_px, x_min, x_max, y_min, y_max)

Widen one data range about its centre so that one y data unit spans aspect_ratio times the pixel length of one x data unit ('equal': ratio 1) in a plot box of plot_width_px x plot_height_px (matplotlib's adjustable='datalim'). 'auto' leaves the limits.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: aspect_mode
real(kind=wp), intent(in) :: aspect_ratio
real(kind=wp), intent(in) :: plot_width_px
real(kind=wp), intent(in) :: plot_height_px
real(kind=wp), intent(inout) :: x_min
real(kind=wp), intent(inout) :: x_max
real(kind=wp), intent(inout) :: y_min
real(kind=wp), intent(inout) :: y_max