fortplot_matplotlib_plots Module

Matplotlib-compatible plot functions for imshow/pie/polar/step/stem/fill.

Color kwargs accept either a named color string or an RGB triple via generic interfaces. fill_between makes y1 required to match matplotlib's contract. fill accepts an optional step stage to mirror matplotlib's stair-fill mode.



Interfaces

public interface polar

  • private subroutine polar_string(theta, r, fmt, label, linestyle, marker, color)

    String-color variant of polar.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(in), contiguous :: theta(:)
    real(kind=wp), intent(in), contiguous :: r(:)
    character(len=*), intent(in), optional :: fmt
    character(len=*), intent(in), optional :: label
    character(len=*), intent(in), optional :: linestyle
    character(len=*), intent(in), optional :: marker
    character(len=*), intent(in), optional :: color
  • private subroutine polar_rgb(theta, r, color, fmt, label, linestyle, marker)

    RGB-color variant of polar. Serialises the RGB triple as a hex string so the underlying implementation remains untouched.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(in), contiguous :: theta(:)
    real(kind=wp), intent(in), contiguous :: r(:)
    real(kind=wp), intent(in) :: color(3)
    character(len=*), intent(in), optional :: fmt
    character(len=*), intent(in), optional :: label
    character(len=*), intent(in), optional :: linestyle
    character(len=*), intent(in), optional :: marker

public interface step

  • private subroutine step_string(x, y, where, label, linestyle, color, linewidth)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(in), contiguous :: x(:)
    real(kind=wp), intent(in), contiguous :: y(:)
    character(len=*), intent(in), optional :: where
    character(len=*), intent(in), optional :: label
    character(len=*), intent(in), optional :: linestyle
    character(len=*), intent(in), optional :: color
    real(kind=wp), intent(in), optional :: linewidth
  • private subroutine step_rgb(x, y, color, where, label, linestyle, linewidth)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(in), contiguous :: x(:)
    real(kind=wp), intent(in), contiguous :: y(:)
    real(kind=wp), intent(in) :: color(3)
    character(len=*), intent(in), optional :: where
    character(len=*), intent(in), optional :: label
    character(len=*), intent(in), optional :: linestyle
    real(kind=wp), intent(in), optional :: linewidth

public interface fill

  • private subroutine fill_string(x, y, color, alpha, step)

    Fill the area between a curve and zero. step activates stair fill to match matplotlib's step argument on fill_between.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(in), contiguous :: x(:)
    real(kind=wp), intent(in), contiguous :: y(:)
    character(len=*), intent(in) :: color
    real(kind=wp), intent(in), optional :: alpha
    character(len=*), intent(in), optional :: step
  • private subroutine fill_rgb(x, y, color, alpha, step)

    RGB-color variant of fill.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(in), contiguous :: x(:)
    real(kind=wp), intent(in), contiguous :: y(:)
    real(kind=wp), intent(in) :: color(3)
    real(kind=wp), intent(in), optional :: alpha
    character(len=*), intent(in), optional :: step
  • private subroutine fill_default(x, y, alpha, step)

    fill called without an explicit color uses the figure palette. Kept as a dedicated overload so matplotlib-style no-color calls remain legal through the generic interface.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(in), contiguous :: x(:)
    real(kind=wp), intent(in), contiguous :: y(:)
    real(kind=wp), intent(in), optional :: alpha
    character(len=*), intent(in), optional :: step

public interface fill_between

  • private subroutine fill_between_string(x, y1, y2, where, color, alpha, interpolate, step)

    Matplotlib-style fill_between with string color. y1 is required (matching matplotlib); y2 defaults to zero.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(in), contiguous :: x(:)
    real(kind=wp), intent(in), contiguous :: y1(:)
    real(kind=wp), intent(in), optional :: y2(:)
    logical, intent(in), optional :: where(:)
    character(len=*), intent(in), optional :: color
    real(kind=wp), intent(in), optional :: alpha
    logical, intent(in), optional :: interpolate
    character(len=*), intent(in), optional :: step
  • private subroutine fill_between_rgb(x, y1, y2, where, color, alpha, interpolate, step)

    RGB-color variant of fill_between. Same positional layout as the string variant; color keyword type distinguishes the two.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(in), contiguous :: x(:)
    real(kind=wp), intent(in), contiguous :: y1(:)
    real(kind=wp), intent(in), optional :: y2(:)
    logical, intent(in), optional :: where(:)
    real(kind=wp), intent(in) :: color(3)
    real(kind=wp), intent(in), optional :: alpha
    logical, intent(in), optional :: interpolate
    character(len=*), intent(in), optional :: step

Subroutines

public subroutine imshow(z, cmap, alpha, vmin, vmax, origin, extent, interpolation, aspect)

Display 2D array as an image (heatmap)

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), contiguous :: z(:,:)
character(len=*), intent(in), optional :: cmap
real(kind=wp), intent(in), optional :: alpha
real(kind=wp), intent(in), optional :: vmin
real(kind=wp), intent(in), optional :: vmax
character(len=*), intent(in), optional :: origin
real(kind=wp), intent(in), optional :: extent(4)
character(len=*), intent(in), optional :: interpolation
character(len=*), intent(in), optional :: aspect

public subroutine pie(values, labels, colors, explode, autopct, startangle)

Create a pie chart

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), contiguous :: values(:)
character(len=*), intent(in), optional :: labels(:)
character(len=*), intent(in), optional :: colors(:)
real(kind=wp), intent(in), optional :: explode(:)
character(len=*), intent(in), optional :: autopct
real(kind=wp), intent(in), optional :: startangle

public subroutine stem(x, y, linefmt, markerfmt, basefmt, label, bottom)

Create a stem plot

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), contiguous :: x(:)
real(kind=wp), intent(in), contiguous :: y(:)
character(len=*), intent(in), optional :: linefmt
character(len=*), intent(in), optional :: markerfmt
character(len=*), intent(in), optional :: basefmt
character(len=*), intent(in), optional :: label
real(kind=wp), intent(in), optional :: bottom

public subroutine twinx()

Activate a secondary y-axis that shares the x-axis but renders on the right

Arguments

None

public subroutine twiny()

Activate a secondary x-axis that shares the y-axis but renders on the top

Arguments

None