I'm trying to make a plot that has two x-axis with one of them nonlinear - twiny() is working great, but I'm hung up on how to get the second axis to be spaced properly. For the sake of example, lets say the first axis is linear on [1,2] - if I just plot data according to that x-axis, all is fine. Now, I also want to see an x-axis on the top that corresponds to, say x2 = x1^3 - then the second axis should be on the range [1,8] . The problem is, it's not a linear mapping from x1 to x2, so I can't just set the xlims on the second axis to 1 and 8 and have it work. I tried making a derived class of Scale (see code below) using the appropriate transform, but it didn't seem to have any effect on the axes. Do I need to do soemthing else with the locators or formatters or something?
class Cubedscale(scale.ScaleBase): name='cubedscale' class CubedTransform(transforms.Transform): input_dims=1 output_dims=1 is_seperable=True has_inverse=False def transform(self,values): return values**3 def __init__(self): pass trans=CubedTransform() def __init__(self, axis, **kwargs): pass def get_transform(self): return trans def set_default_locators_and_formatters(self,axis): axis.set_major_locator(AutoLocator()) axis.set_major_formatter(ScalarFormatter()) axis.set_minor_locator(NullLocator()) axis.set_minor_formatter(NullFormatter()) scale.register_scale(CubedScale) xaxis.set_scale('cubedscale') ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users