Skip to content

bug: .dat savefig uses PNG backend #1279

@krystophny

Description

@krystophny

Summary

Saving with a .dat extension does not switch to the ASCII backend. get_backend_from_filename only recognizes .png, .pdf, and .txt, so .dat falls back to PNG.

Steps to Reproduce

  1. Call fig%savefig('output.dat') from any existing example (or run the snippet below).
  2. Inspect the resulting file – the PNG backend is still active.
program repro
    use fortplot_utils, only: get_backend_from_filename
    implicit none

    print *, trim(get_backend_from_filename('output.dat'))
end program repro

The program above prints png, confirming the backend detection does not route .dat to the ASCII backend.

Expected Behavior

.dat should select the ASCII backend (same as .txt) so users get the text-friendly output documented in src/documentation/fortplot_documentation.f90.

Additional Context

The docs list .dat among the recognized media extensions, and several verification helpers emit .dat files in test/output/. Restoring ASCII routing keeps the CLI consistent with the documentation.

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