figure in matplotlib doesn't show plots created in axes
See original GitHub issueEnvironment data
- VS Code version: 1.32.3
- Extension version (available under the Extensions sidebar): Python 2019.3.6558
- OS and version: Windows 1709
- Python version (& distribution if applicable, e.g. Anaconda): Ptyhon 3.7.3
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): virtualenv
- Relevant/affected Python packages and their versions: matplotlib
Expected behaviour
I am trying to practice using matplotlib in VSCode. In Jupyter, I can do the following. Basically, after I created figure & axes, if I created any plots in axes, figure will show the plot.
Actual behaviour
However, if I do exactly the same in VSCode, figure will return nothing. ax1’s plot cannot be shown in the figure.
Steps to reproduce:
import numpy as np
import pandas as pd
from fastai.imports import *
import pyodbc
import matplotlib.pyplot as plt
import seaborn as sns
from IPython.display import display
fig = plt.figure()
ax1 = fig.add_subplot(2, 2, 1)
ax2 = fig.add_subplot(2, 2, 2)
ax3 = fig.add_subplot(2, 2, 3)
ax1.hist(np.random.randn(100), bins=20, color='k', alpha=0.3)
fig
It will have different results between Jupyter and VSCode. Figure should be able to show what has been plotted in axes.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Why are my plots in matplotlib not showing the axes
I think the line ax = fig.add_axes([0,0,1,1]) is the problem -- it uses all figure space for the plot and leaves none for...
Read more >figure in matplotlib doesn't show plots created in axes #3148
I am trying to practice using matplotlib in VSCode. In Jupyter, I can do the following. Basically, after I created figure & axes,...
Read more >Resolved: Matplotlib figures not showing up or displaying
Ever try to plot a matplotlib figure and not have it display to your screen? I'll show you how to fix when matplotlib...
Read more >How To Display A Plot In Python using Matplotlib - ActiveState
Click to display a Plot in Python using Matplotlib's two APIs. Create simple, scatter, histogram, spectrum and 3D plots.
Read more >matplotlib.pyplot.show — Matplotlib 3.6.2 documentation
Enable interactive mode, which shows / updates the figure after every plotting command, so that calling show() is not necessary.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ronglums sorry for the late reply. Looks like it works with the light theme! Is it possible to make matplotlib supports the dark theme? I really like the dark theme and don’t want to change to light because of matplotlib.
dupe of microsoft/vscode-jupyter#2904