Skip to content

streamplot shows arrows by default when it should only show plain streamlines #1417

@krystophny

Description

@krystophny

Problem Description

The streamplot() function shows arrows by default even when no arrowsize or arrowstyle parameters are provided. This contradicts the expected behavior where streamlines should be plain lines without arrows unless explicitly requested.

Current Behavior

When calling:

call streamplot(x, y, u, v, density=1.0_wp)

The output shows arrows on the streamlines (both PNG and PDF).

Expected Behavior

  • Without arrow parameters: Plain streamlines (no arrows)
  • With arrow parameters: Streamlines with arrows
    call streamplot(x, y, u, v, density=1.0_wp, arrowsize=1.5_wp, arrowstyle='->')

This matches matplotlib's behavior where streamplot() shows plain lines by default and arrows are opt-in via parameters.

Evidence

Current output (incorrectly shows arrows):
file:///home/ert/code/fortplot/output/example/fortran/streamplot_demo/streamplot_demo.png

Source code at line 31 of example/fortran/streamplot_demo/streamplot_demo.f90:

call streamplot(x, y, u, v, density=1.0_wp)  ! No arrow parameters

The example explicitly creates TWO variants:

  1. Base streamplot (line 31) - should have NO arrows
  2. Arrow variant (line 43) - should have arrows with arrowsize=1.5_wp, arrowstyle='->'

Currently both show arrows, making them indistinguishable.

Root Cause

Likely in streamplot implementation where arrow rendering is enabled by default instead of being conditional on arrowsize/arrowstyle parameters being present.

Files Involved

  • Streamplot implementation: src/plotting/fortplot_streamplot_*.f90
  • Arrow rendering: Backend-specific (raster/vector)

Impact

  • Unexpected default behavior differs from matplotlib
  • Users cannot create plain streamlines without arrows
  • Example demonstrates incorrect behavior

Related Issues

Reported in #1413 but not a PDF-specific issue - affects both PNG and PDF backends equally. This is a default parameter/logic issue in the streamplot implementation.

Priority

Medium - Functional but behavior doesn't match expected matplotlib-style API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions