Python Forum
Matplotlib Functions - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Matplotlib Functions (/thread-36673.html)



Matplotlib Functions - DaveG - Mar-17-2022

Hi

I'm running a script in Python3 that is calling for the module matplotlib.pyplot for which I get a message

> pip install pyplot
ERROR: Could not find a version that satisfies the requirement pyplot (from versions: none)
ERROR: No matching distribution found for pyplot

I have installed matplotlib successfully but it doesn't seem to have pyplot with it. Can anybody help please?


RE: Matplotlib Functions - BashBedlam - Mar-17-2022

Have you tried thisfrom matplotlib import pyplot?
from matplotlib import pyplot
pyplot.plot ([1, 2, 3, 4])
pyplot.ylabel ('some numbers')
pyplot.show ()



RE: Matplotlib Functions - DaveG - Mar-17-2022

Hi Bashbedlam

I get the error
+ from matplotlib import pyplot
+ ~~~~
The 'from' keyword is not supported in this version of the language.


RE: Matplotlib Functions - jefsummers - Mar-17-2022

What version of Python are you running?
Have you installed matplotlib?


RE: Matplotlib Functions - deanhystad - Mar-17-2022

I am very confused. Back on March 14 you posted: https://python-forum.io/thread-36650.html which contains code that uses matplotlib.pyplot. There are also references to Python 2.7. Here you reference Python 3. 3.what version is not disclosed.

Are you running Python 2.7 or 3.x? And fi 3.x, what is the x? 6, 8, 10, other? What is your operating system? Are you running straight Python or Anaconda?


RE: Matplotlib Functions - DaveG - Mar-17-2022

I'm using Python 3.8

The module matplotlib-inline was installed which may have confused things. I have uninstalled this and reinstalled matplotlib.

Is there a command to list the functions of matplotlib to see if pyplot is there? I have tried >>import matplotlib, dir(matplotlib) without sucess.


RE: Matplotlib Functions - jefsummers - Mar-18-2022

When you say "without success", what happens?
What is your development environment? Are you using VSCode, Spyder, IDLE, or what?