Errorbars in matplotlib
Sunday, January 27th, 2008Here’s how to plot x or y errorbars (or both) and how to customize the resulting plot.
(more…)
Here’s how to plot x or y errorbars (or both) and how to customize the resulting plot.
(more…)
The matplotlibrc file contains many useful parameters for tweaking your setup to your liking, and it’s worth at least skimming through to get an idea of what it contains. Editing the file makes more permanent changes, while using the pylab rcParams dictionary or rc() and rcdefaults() functions lets you make and revert changes on the fly.
View the rc parameters by using
import pylab as p
print p.rcParams
Examples ensue.
(more…)
Set the rc parameters using the rc function.
import pylab as p
p.rc(('xtick.major','xtick.minor','ytick.major','ytick.minor'), pad=10)
p.plot([1,2,3])
If you only want to change one of the tick labels, say, the x major ticks, use
p.rc(’xtick.major), pad=10)
When you’re done and want to reset the rc settings, use
p.rcdefaults()
See matplotlibrc for more settings you can change via the rc command.
Today I was trying to figure out how to plot two time series with differently scaled values. I found two_scales.py example in the matplotlib examples which describes how to do it.
Here’s a slightly simplified version of the code, and afterward a detailed explanation of what’s going on. (more…)
Bar plots are one of the simplest kinds of plots, but for some reason in many programs it’s difficult to get the labels you want, correct error bars, and control over every aspect of the plot. Here’s how to create a custom bar plot using the Python plotting module matplotlib. (more…)