Questions tagged [matplotlib]

Matplotlib is a 2D plotting library for Python, built on NumPy and often used interactively with IPython. Its "pylab" interface is similar to the plotting functions of MATLAB®.

Matplotlib can output PNG, PDF, EPS, and SVG files, or plot in windows using a variety of toolkits.

Resources to get started:

Many questions about matplotlib usage can also be handled at Computational Science SE (including those which may not qualify as programming).

Resources

Disclaimer: This tag description is a 100% copy from the stackoverflow matplotlib tag wiki.

87 questions
2
votes
1 answer

Writing probability density function in Latex

How to write the following probability density function for gaussian distribution in Latex (Matplotlib) p(x) = \frac{1}{\sqrt{ 2 \pi \sigma^2 }} e^{ - \frac{ (x - \mu)^2 } {2 \sigma^2} },
2
votes
1 answer

Scale down the size of a PGF figure

I've created a plot using matplotlib in Python and saved it to a PGF which I've then embedded in my LaTeX document. I'd like it to be a bit smaller, as is it won't centre and it forces down a section's header which is supposed to be above it. Here's…
2
votes
1 answer

The one of the Matploltlib example

import numpy as np import matplotlib matplotlib.rcParams['text.usetex'] = True import matplotlib.pyplot as plt t = np.linspace(0.0, 1.0, 100) s = np.cos(4 * np.pi * t) + 2 fig, ax = plt.subplots(figsize=(6, 4), tight_layout=True) ax.plot(t,…
joshua
  • 21
1
vote
0 answers

Error in Matplotlib in legend

If I include this plt.legend(['$0.25+\zeta$'], loc = 1)in my code, I am not getting error. But plt.legend(['$\frac{1}{4}+\frac{\alpha}{10}$'], loc = 1) gives error.
user12290
  • 3,341
1
vote
1 answer

How to display D-stroke symbol in matplotlib

I want to display the D-stroke symbol (\DJ) using the following code, but I failed. Could anyone tell me how to make it correct? As shown in the figure, the symbol $\mu$ works well but the $\DJ$ symbol doesn't appear. Any advice and suggestions will…
Zidan
  • 11
0
votes
1 answer

PGF generated with matplotlib contourf produces artifacts in pdf

I generate a contourplot with matplotlib.pyplot.contourf that produces a nice preview image: But when I include the image into my document (using the exact same settings that I successfully employ for 1D plots) I observe some artifacts in the pdf…
Dan Doe
  • 111
0
votes
0 answers

Are there any potential risks of avoiding type 3 fonts when using matplotlib to draw figures

Many conferences/journals start asking me to use Type 1 font in the submitted PDF. So when I use matplotlib to generate figures, I have two choices: Configure matplotlib to only use tex fonts rcParams['ps.useafm'] =…
Harper
  • 133
  • 4