question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Matplotlib backend automatically set as 'Agg' when Catalyst is imported.

See original GitHub issue

🐛 Bug Report

https://github.com/catalyst-team/catalyst/blob/93774200bc65f5c5ee7e2ad9935fee901c277be0/catalyst/contrib/utils/visualization.py#L6

matplotlib.use("Agg") set the backend of catalyst to agg, which requires user to click to close the visualization window. I think it would be better if it is kept in original matplotlib backend.

please make a test before allowing the pull request.

How To Reproduce

Steps to reproduce the behavior:

  1. run first script, in PyCharm with Catalyst installed Env.
  2. run second script, in PyCharm with Catalyst installed Env.
  3. make comparison

Code sample

import numpy as np
import matplotlib.pyplot as plt
image = np.random.random([800,800,3]) * 255.0
plt.imshow(image)
plt.show()

from catalyst import dl, utils
from catalyst.data import ToTensor
from catalyst.contrib.datasets import MNIST

import numpy as np
import matplotlib.pyplot as plt
image = np.random.random([800,800,3]) * 255.0
plt.imshow(image)
plt.show()

Screenshots

Expected behavior

In pycharm, it supposed that the image should pop up in the SciView window, but after importing catalyst packages, it doesn’t appear, after commenting the matplotlib.use("Agg"), unexceptional behavior disappeared.

Environment

Additional context

Checklist

  • [ x ] bug description
  • [ x ] steps to reproduce
  • [ x ] expected behavior
  • [ x ] environment
  • [ x ] code sample / screenshots

FAQ

Please review the FAQ before submitting an issue:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
penguinflyscommented, Aug 4, 2021

image focusing only on plotting, I think it is right. An PR is already made, but not sure if it is hotfix or not.

0reactions
penguinflyscommented, Aug 9, 2021

As MR is already done, This issue is closed now

Read more comments on GitHub >

github_iconTop Results From Across the Web

Backends — Matplotlib 3.6.2 documentation
Without a backend explicitly set, Matplotlib automatically detects a usable backend based on what is available on your system and on whether a...
Read more >
How can I set the 'backend' in matplotlib in Python?
AGG backend is for writing to file, not for rendering in a window. See the backend FAQ at the matplotlib web site. ImportError:...
Read more >
Automatically set a backend if no default backend is ... - GitHub
I think the --no-plot flag is separate but related. This issue should be fixed as stated in the SO post using. import matplotlib...
Read more >
Spark SQL, DataFrames and Datasets Guide
Here we include some basic examples of structured data processing using Datasets: Scala; Java; Python; R. // This import is needed to use...
Read more >
Cisco Catalyst 9800 Series Configuration Best Practices
Describes best practices for configuring a typical Cisco Catalyst 9800 Series wireless infrastructure, including profiles and tags, controller and access ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found