Combining Linear and Logarithmic Plots


I need to create a Linear Regression plot where the vertices are plotted on a logarithmic plane
and the regression line is plotted on a linear plane. The two are then combined. Here is what I
have so far:

from pylab import *

prediction_experiment = [(313.11000000000001, 25.797999999999998), (4499.1999999999998, 25000.0),
(168830.0, 440000.0), (143090.0, 78571.399999999994), (34811.0, 78571.399999999994), (161240.0,

def log10Product(x, pos):
    """The two args are the value and tick position.
    Label ticks with the product of the exponentiation"""
    return '%1i' % (x)

def generateLRPlot():
    x, y = map(array, zip(*prediction_experiment))
    ax = subplot(111)
    formatter = FuncFormatter(log10Product)
    # the bestfit line from polyfit
    m, b = polyfit(x, y, 1) # a line is 1st order polynomial...

    plot(x, y, 'b.', x, m*x+b, 'r', linewidth=0.1, markersize=2)
    # Must add 1 to allow the last decades label to be shown
    ax.set_xlim(1e-1, max(x)+1)
    ax.set_ylim(1e-1, max(y)+1)
    xlabel(r"Prediction", fontsize = 12)
    ylabel(r"Experimental IC50 [nM]", fontsize = 12)
    # clear the matplotlib figure and axis

Thanks for the help,
Derek Basch


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around