Python Forum
matplotlib, no plot when using Figure
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
matplotlib, no plot when using Figure
#1
Hello,
as I am breaking by brains about this, I hope you can give me a suggestion.
I work on Linux / openSUSE 15.3 and python 3.9.4 in a virtual console.
I can not understand why this is not providing a plot output

import matplotlib.pyplot as plt
from matplotlib.figure   import Figure

fig = Figure(figsize=(5, 4), dpi=100)           # Create a in memory figure
ax  = fig.add_subplot(111)                      # Create a axes in fig
ax.plot([1, 2, 3, 4], [1, 4, 2, 3])
plt.show()                                      # Show in X
and this does

fig, ax = plt.subplots()               
ax.plot([1, 2, 3, 4], [1, 4, 2, 3])
plt.show() 
Thanks, Anthony
Reply


Messages In This Thread
matplotlib, no plot when using Figure - by ajvperth - Oct-10-2021, 12:39 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Graphic line plot with matplotlib, text file in pytho khadija 2 1,438 Aug-15-2022, 12:00 PM
Last Post: khadija
  plot on the same figure using a for loo with matplotlib drSlump 2 1,750 Oct-13-2021, 07:11 AM
Last Post: drSlump
  Matplotlib: How do I convert Dates from Excel to use in Matplotlib JaneTan 1 3,291 Mar-11-2021, 10:52 AM
Last Post: buran
  Python Matplotlib: How do I plot lines with different end point in the same graph? JaneTan 0 1,607 Feb-28-2021, 11:56 AM
Last Post: JaneTan
  How to plot intraday data of several days in one plot mistermister 3 2,986 Dec-15-2020, 07:43 PM
Last Post: deanhystad
  saving only one line of a figure as an image (python matplotlib) nitrochloric 0 2,062 Nov-23-2020, 01:41 PM
Last Post: nitrochloric
  Difference Between Figure Axis and Sub Plot Axis in MatplotLib JoeDainton123 2 2,522 Aug-21-2020, 10:17 PM
Last Post: JoeDainton123
  Understanding The Arguments for matplotlib.pyplot.plot JoeDainton123 0 1,960 Aug-19-2020, 01:19 AM
Last Post: JoeDainton123
  How to plot gantt chart using matplotlib Mekala 1 2,689 Jul-16-2020, 07:21 PM
Last Post: Marbelous
  How can I make a plot representing connection relationship with python matplotlib? Berlintofind 1 1,995 May-08-2020, 09:27 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020