Here’s how to plot x or y errorbars (or both) and how to customize the resulting plot.
(more…)
Posts Tagged ‘pylab’
Errorbars in matplotlib
Sunday, January 27th, 2008Adjust settings for matplotlib using rc and matplotlibrc
Monday, January 21st, 2008The 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…)
Change distance of tick labels from axis
Thursday, January 17th, 2008Set 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.
Create a second y-axis in matplotlib
Sunday, December 2nd, 2007Today 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…)