Skip to content

Warning for draw_svg plot uses logging module instead of warnings #2870

@duncanMR

Description

@duncanMR

I came across a minor issue with the plotting code: the draw_svg warning for mutations above unplotted nodes uses the logging module instead of the warnings module, that we'd usually use for user warnings. I discovered this because I couldn't find a way to suppress it. The warning is currently this:

if len(unplotted) > 0:
     logging.warning(
          f"Mutations {unplotted} are above nodes which are not present in the "
          "displayed tree, so are not plotted on the topology."
     )

If we were to use warnings instead, I'm guessing we'd do something like this? I'm not sure what stack level is appropriate here.

if len(unplotted) > 0:
     warnings.warn(
          f"Mutations {unplotted} are above nodes which are not present in the "
          "displayed tree, so are not plotted on the topology.",
          UserWarning,
          stacklevel=2
     )

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions