Giter VIP home page Giter VIP logo

matplotlib's Introduction

PyPi Downloads NUMFocus

DiscourseBadge Gitter GitHubIssues GitTutorial

Travis AzurePipelines AppVeyor Codecov LGTM

Matplotlib

Matplotlib is a Python 2D plotting library which produces publication-quality figures in a variety of hardcopy formats and interactive environments across platforms. Matplotlib can be used in Python scripts, the Python and IPython shell (à la MATLAB or Mathematica), web application servers, and various graphical user interface toolkits.

NOTE: The current master branch is now Python 3 only. Python 2 support is being dropped.

Home page

Install

For installation instructions and requirements, see the INSTALL.rst file or the install documentation. If you think you may want to contribute to matplotlib, check out the guide to working with the source code.

Test

After installation, you can launch the test suite:

pytest

Or from the Python interpreter:

import matplotlib
matplotlib.test()

Consider reading http://matplotlib.org/devel/coding_guide.html#testing for more information. Note that the test suite requires pytest. Please install with pip or your package manager of choice.

Contact

Discourse is the discussion forum for general questions and discussions and our recommended starting point.

Our active mailing lists (which are mirrored on Discourse) are:

Gitter is for coordinating development and asking questions directly related to contributing to matplotlib.

Contribute

You've discovered a bug or something else you want to change - excellent!

You've worked out a way to fix it – even better!

You want to tell us about it – best of all!

Start at the contributing guide!

Developer notes are now at Developer Discussions (Note: For technical reasons, this is currently only accessible for matplotlib developers.)

Citing Matplotlib

If Matplotlib contributes to a project that leads to publication, please acknowledge this by citing Matplotlib. A ready-made citation entry is available.

matplotlib's People

Contributors

tacaswell avatar mdboom avatar anntzer avatar jdh2358 avatar efiring avatar dstansby avatar jklymak avatar timhoffm avatar qulogic avatar nellev avatar jenshnielsen avatar weathergod avatar pelson avatar dopplershift avatar ddale avatar leejjoon avatar jkseppan avatar dmcdougall avatar astraw avatar phobson avatar cgohlke avatar tonysyu avatar ericmjl avatar afvincent avatar blink1073 avatar cmoad avatar kojoley avatar ivanov avatar importanceofbeingernest avatar jankatins avatar

Watchers

James Cloos avatar

matplotlib's Issues

Bug Fix: “Size” ignored if placed before fontproperties

In as.text, ax.set_title and all the functions realated to displaying characters on the figure,
the arguement size is ignored if it is placed before fontproperties.

Code for reproduction

plt.hist(data, bins=40, facecolor="blue", edgecolor="black", alpha=0.5)
plt.xlabel("value", fontproperties='SimHei',size=20  ) # this will work
plt.ylabel("counts",size=20, fontproperties='SimHei')  # this doesn't
plt.show()

This issue is replicated with ipython (%pylab) and jupyter-notebook

matplotlib#16389

Bug Fix: Memory leak with log scale in pcolorfast, pcolormesh, imshow

Consider the following spectrogram animation, matplotlib seems leaks memory when switched to log scale on the Y axis, for the functions pcolorfast, pcolormesh, imshow and specgram

from scipy.signal.spectral import spectrogram
from scipy.signal.waveforms import chirp

import matplotlib.animation as animation
import matplotlib.pyplot as plt
import numpy as np

fs = 8000 # sampling rate
t = np.arange(0, 5.0, 1/fs) # 5 seconds of time

fig, axes = plt.subplots(nrows=1)

def signal(t): # generates a "chirp" signal
    return chirp(t = t, f0 = 100.0,  f1 = 3000.0, t1 = 10.0)

def spect(x): # computes spectrogram
    freq, time, Sxx = spectrogram(x, fs = fs, nfft = 1024, noverlap = 512, nperseg = 1024)
    Z = 10 * np.log10(Sxx)
    return freq, time, Z

y = signal(t)
freq, time, Z = spect(y)
im = axes.pcolorfast(time, freq, Z)
axes.set_xlabel('t [s]')
axes.set_ylabel('f [Hz]')
axes.set_yscale('log') # <-- exposes the leak
axes.set_ylim(0, fs/2)

def animate(i):
    y = signal(t + i/30.0) # sliding temporal window
    freq, time, Z = spect(y)
    im.set_data(Z)
    return [ im ]

ani = animation.FuncAnimation(fig, animate, np.arange(1, 200), 
                              interval=0, blit=True)
plt.show()

Everything stays stable if we switch to a linear scale on the Y axis, commenting out the line

axes.set_yscale('log')

matplotlib#15474

Bug Fix: Axes with sharex can have divergent axes after setting tick markers

Plots that use sharex have the same x-axis but when plt.xticks changes it appears only the second of the two plots gets the updated x-tick range.

import matplotlib.pyplot as plt
fig, (ax1, ax2) = plt.subplots(2, sharex=True)
ax1.plot(range(0, 10), range(0, 10))
ax2.plot(range(0, 10), range(0, 10))
plt.xticks(range(0, 30))
plt.show()

Example of Issue

Previous Fix For This Issue

This bug was fixed back in 2018 but the rebase to master was postponed too long and the changes in the pr can no longer be merged into master.

matplotlib#10691

Original Matplotlib Issue

matplotlib#8946

Bug Fix: Tick Labels Rendering Under Curve

Tick labels are being drawn behind the curve, even though xtick.zorder is set to a value higher than line.zorder

Example of Issue

Tick labels should be above the curve.
Changing xtick.zorder doesn't have any effect.
Changing line.zorder to <= 1.5 produces the correct result.

Original Matplotlib Issue

matplotlib#13863

Bug Fix: Rotated Text Does Not Align

Rotating different text by 90 degrees gives different alignments.

Example of Issue

When rotating text, the bbox (the orange box) is in the correct position, but the text is not rendered in the correct position within the bbox

Original Matplotlib Issue

matplotlib#14239

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.