What is Matplotlib: Definition and 17 Discussions

Matplotlib is a plotting library for the Python programming language and its numerical mathematics extension NumPy. It provides an object-oriented API for embedding plots into applications using general-purpose GUI toolkits like Tkinter, wxPython, Qt, or GTK. There is also a procedural "pylab" interface based on a state machine (like OpenGL), designed to closely resemble that of MATLAB, though its use is discouraged. SciPy makes use of Matplotlib.
Matplotlib was originally written by John D. Hunter. Since then it has an active development community and is distributed under a BSD-style license. Michael Droettboom was nominated as matplotlib's lead developer shortly before John Hunter's death in August 2012 and was further joined by Thomas Caswell.Matplotlib 2.0.x supports Python versions 2.7 through 3.10. Python 3 support started with Matplotlib 1.2. Matplotlib 1.4 is the last version to support Python 2.6. Matplotlib has pledged not to support Python 2 past 2020 by signing the Python 3 Statement.

View More On Wikipedia.org
  1. PeroK

    Python Problem importing matplotlib in Python

    I'm running Python 3.8.3 on Windows 10 and was have installed matplotlib, but I can't get it to work. If I try import matplotlib then first it seems to spit out some output (always the same) from a couple of basic test programs I wrote (which is really weird), then just gets a bunch of errors...
  2. J

    Python How to Plot y=x^2 Using Matplotlib?

    import matplotlib.pyplot as plt R = 2 for x in range(0,50): y = x**R # plt.plot(x,y,marker = 'o') plt.plot(x,y,'--') plt.xlabel('X-axis') plt.ylabel('Y-axis') plt.title('plot test') plt.legend() plt.show()
  3. fluidistic

    Matplotlib with pgf backend, problem with underscore

    I use matplotlib to create files.pgf that I can \include{} in my latex documents. All works nicely, except when I want to make a reference to some equation of my latex document. For example, I when plot several curves on a graph and label them as "Coming from expression ..." where ... is...
  4. amjad-sh

    Python Changing the default font in matplotlib to "Times New Roman".

    I want to submit an article to an aps journal, so the labels of the figures have the "Times New Roman" font. I had used the package matplotlib to get the figures and I want to make "Times New Roman" the default font. So, what code I need to write for this to be achieved? Note that I used the...
  5. Wrichik Basu

    C/C++ From when does matplotlib require Visual C++? (Python 3.8.0)

    I had Python 3.7.3 installed on my laptop. I decided to upgrade to 3.8.0, and after installing all necessary packages, uninstall the old version. The installation of 3.8.0 was successfully done. With pip, I installed scipy, numpy and sympy. Now when I tried to install matplotlib, it threw an...
  6. Arman777

    Why matplotlib is not working on the VSCode

    I wrote a basic plotting code and I run it on the VS code my somehow the program cannot run it I deleted python itself and VS code and I downloaded them again, but the problem is not solved. import matplotlib.pyplot as plt x = [1,2,3] y = [4,5,6] plt.plot(x,y) plt.show()...
  7. S

    Python Fitting xtickslabels on a plot (matplotlib)

    How could I improve the below code to fit all the xtickslabels on my plot more nicely (i.e. more spacing between the labels, higher resolution)? Thanks! from pyplot import * yearmonthday=['2003-01-01', '2003-02-01', '2003-03-01', ...] #len(yearmonthday) is 155 kwh = [88883, 99221, 100002, ...]...
  8. Danny Boy

    Animation using matplotlib query

    I am trying to animate a plot of two distinct points (blue and green points) moving about the complex unit circle using Python's Matplotlib library. The problem I am having is that the animation does not remove and update the previous data points but rather sequentially smears it on the unit...
  9. Avatrin

    Python Plotting a 2d trajectory with Matplotlib

    Hi I have a 2d trajectory of a center of mass which I have saved in an array such that r=[[x(t_1),y(t_1)],[x(t_2),y(t_2)],...,[x(t_n),y(t_n)]] where x is x coordinate of the position and y is the y-coordinate of the position. I have tried this: xx = [t[0] for t in r] xy = [t[1] for t in r]...
  10. JD_PM

    Python How to plot vector fields in Matplotlib

    Hi, I want to plot the vector field ##\vec F = ye^x \hat i + (x^2 + e^x) \hat j + z^2e^z \hat k## The code I have tried: # The components of the vector field F_x = y*e**x F_y = x**2 + e**x F_z = z**2*e**z# The grid xf = np.linspace(-0.15, 2.25, 8) yf = np.linspace(-0.15, 2.25, 8) zf =...
  11. J

    Python Contour plot of Earth's magnetic field in Python

    The Earth's magnetic field is cylindrically symmetric and can be described using cylindrical coordinates, (ρ,z,φ). The components of the magnetic field are given by: (B_φ) = 0 (B_ρ) = −∂A/∂z, (B_z) =(1/ρ) * ∂(ρA)/∂ρ. The vector potential for a dipole field is given by (A_φ) = (B_e)(ρ) *...
  12. Morbidly_Green

    Python Removing previously plotted points on scatter plot; python

    Homework Statement I'm plotting moving particles and I need a way to refresh the graph space with every loop. Meaning I want the points to NOT leave a trail of other points behind them . Basically I want to get rid of the old points as I plot new ones. Homework Equations N\A The Attempt at a...
  13. A

    Python Help with Python modelling of a particle in a 2D box

    Hello guys, I programmed a physics simulation where a particle with some initial conditions bounces off the walls of a 2d container. The simulation also includes gravity in the y-coordinates. The aim of the project is to produce a visual animation and further on include more particles and...
  14. sk1105

    Python [Python] Custom tick marks in matplotlib

    I've looked around for this and so far haven't found anything close enough to what I'm after. In matplotlib, I want to get a specific tick on the x-axis to label a particular value. I know how to use axvline to get a vertical line marking that point, which is good, and I know how to add...
  15. F

    Python Python, matplotlib plot 2D histogram on polar axis.

    Any python/matplotlib experts out there?? This one has been driving me crazy all day. I have three vectors, azimuth, frequency and power, which I would like to histogram and plot on a polar axis. I can plot a scatter plot this way no problem but the histogram gets messed up somehow. An example...
  16. A

    Mathematica Mathematica vs gnuplot vs matplotlib (efficency)

    Hi, I'm currently working on a C program where I have a huge 2d array that changes with time, so in the end, what I have is a 3d array (double 25*24000*100) in a plain text file (about 700MB). I tried to import with Mathematica7 as a "Table" but after a long time (about 15 minutes) the kernel...
  17. B

    Matplotlib- scaling the marker with the grid.

    Hi there, I am plotting some data onto a hammer plot using ipy- matplotlib. The axes on the plot range from alpha= -pi:pi and beta=-pi/2:pi/2. I have a value (lets call it delta) for each point on the plot where (alpha=integer,beta=integer). I have arranged the delta values in ascending order...