Here’s how to plot x or y errorbars (or both) and how to customize the resulting plot.
Continue reading ‘Errorbars in matplotlib’
Tag Archive for 'pylab'
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.
Continue reading ‘Adjust settings for matplotlib using rc and matplotlibrc’
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. Continue reading ‘Create a second y-axis in matplotlib’