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.

Show plots in the Plots pane and in an interactive backend simultaneously

See original GitHub issue

The plot panel is useful but I have a few problems with it:

  • The images are saved by default as low quality png. I would prefer svg and therefore need to:
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('svg')

before plotting. I think it would be nice to have a setting in the plot widget to choose one of 'png', 'retina', 'jpeg', 'svg', 'pdf'.

  • The images are not shown if the backend is interactive (For example qt5). I think it would be great if there was a button to change the backend between inline and interactive, and if the interactive backend plots where shown in the widget. This works by:
%matplotlib qt5
from IPython.core.display import display
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot()
ax.plot([1, 2, 4])
display(fig)

But this also displays the plot inline. One implementation could patch the figure show method and get the image data by:

%matplotlib qt5
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot()
ax.plot([1, 2, 4])
format = get_ipython().kernel.shell.display_formatter.format
format_dict, md_dict = format(fig)

and then send format_dict by the comm channel.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
impact27commented, Apr 8, 2020

plot

1reaction
impact27commented, Apr 7, 2020

I can do the communication with the kernel: plot

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plots — Spyder 5 documentation
The Plots pane shows the static figures and images created during your session. It will show you plots from the IPython Console, produced...
Read more >
Spyder 4 Plots Pane Not Displaying - Stack Overflow
I have ensured that the backend is set to Inline but the pane still does not show up. Code. Console. Settings. If anyone...
Read more >
Visualisation and plotting with Matplotlib - wradlib
It provides the basis for ωradlib's entire visualisation module, and is typically used together with NumPy - which is the other major ωradlib...
Read more >
Matplotlib plots in PyQt5, embedding charts in ... - Python GUIs
Many other Python libraries — such as seaborn and pandas— make use of the Matplotlib backend for plotting. These plots can be embedded...
Read more >
Tutorial - Julia Plots
The plot is displayed in a plot pane, a stand-alone window or the browser, depending on the environment and backend (see below). If...
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