## matplotlib-users

 [Matplotlib-users] nonlinear axes for imshow From: thkoe002 - 2009-10-12 10:59:21 ```Hello, I have the following problem. I want the axes (only the y-axis, to be exact) of a imshow() graph to be nonlinear. By default, the axis goes linearily from 0 to (number of pixels). With the [extent] keyword, I can change that to going linearly from (arbitrary start) to (arbitrary end). Now, I'd like the axis to be dependend on a (bijective) arbitrary function, for example y=p^2 (when p is the pixel number and y the y-axis coordinate). How can I achieve this? Thanks a lot, cheers Thomas -- View this message in context: http://www.nabble.com/nonlinear-axes-for-imshow-tp25853828p25853828.html Sent from the matplotlib - users mailing list archive at Nabble.com. ```
 Re: [Matplotlib-users] nonlinear axes for imshow From: Eric Firing - 2009-10-12 19:59:22 ```thkoe002 wrote: > Hello, > > I have the following problem. I want the axes (only the y-axis, to be exact) > of a imshow() graph to be nonlinear. By default, the axis goes linearily > from 0 to (number of pixels). With the [extent] keyword, I can change that > to going linearly from (arbitrary start) to (arbitrary end). Now, I'd like > the axis to be dependend on a (bijective) arbitrary function, for example > y=p^2 (when p is the pixel number and y the y-axis coordinate). > How can I achieve this? > Thanks a lot, cheers > > Thomas See http://matplotlib.sourceforge.net/examples/pylab_examples/image_nonuniform.html Eric ```
 Re: [Matplotlib-users] nonlinear axes for imshow From: thkoe002 - 2009-10-13 06:48:53 ```Hi Eric, thanks for the help, but this doesn't do what I want. I don't want to change the image in any way, I just want the axes to have a decreasing spacing. I made a small example with ms paint to clarify. http://www.nabble.com/file/p25867951/axes.png I could do this with ax.set_xticks() and ax.set_xticklabels(), but I was wondering if there is a way that also changes the whole coordinate system and not only the labeling. For example, the position of the mouse pointer will not be shown anymore when I use custom ax.set_xticklabels(). Cheers Thomas efiring wrote: > > thkoe002 wrote: >> Hello, >> >> I have the following problem. I want the axes (only the y-axis, to be >> exact) >> of a imshow() graph to be nonlinear. By default, the axis goes linearily >> from 0 to (number of pixels). With the [extent] keyword, I can change >> that >> to going linearly from (arbitrary start) to (arbitrary end). Now, I'd >> like >> the axis to be dependend on a (bijective) arbitrary function, for example >> y=p^2 (when p is the pixel number and y the y-axis coordinate). >> How can I achieve this? >> Thanks a lot, cheers >> >> Thomas > > See > http://matplotlib.sourceforge.net/examples/pylab_examples/image_nonuniform.html > > Eric > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://www.nabble.com/nonlinear-axes-for-imshow-tp25853828p25867951.html Sent from the matplotlib - users mailing list archive at Nabble.com. ```
 Re: [Matplotlib-users] nonlinear axes for imshow From: Jae-Joon Lee - 2009-10-13 16:18:26 ```On Tue, Oct 13, 2009 at 2:48 AM, thkoe002 wrote: > > Hi Eric, > > thanks for the help, but this doesn't do what I want. > I don't want to change the image in any way, I just want the axes to have a > decreasing spacing. I made a small example with ms paint to clarify. > > http://www.nabble.com/file/p25867951/axes.png > > I could do this with ax.set_xticks() and ax.set_xticklabels(), but I was > wondering if there is a way that also changes the whole coordinate system > and not only the labeling. For example, the position of the mouse pointer > will not be shown anymore when I use custom ax.set_xticklabels(). > It depends on how far you want to go. * Manually setting ticks is a easiest solution, I guess. * The next step would be to create your custom tick locator & formatter http://matplotlib.sourceforge.net/api/ticker_api.html While this is not that difficult, you will need to spend some time. * axes_grid toolkit has limited support for arbitrary coordinate system. http://matplotlib.sourceforge.net/examples/axes_grid/demo_curvelinear_grid.html * create your own projection. http://matplotlib.sourceforge.net/devel/add_new_projection.html Unless you're familiar with matplotlib and some of it internals, the last two options is not recommended. Regards, -JJ > Cheers > > Thomas > > > > efiring wrote: >> >> thkoe002 wrote: >>> Hello, >>> >>> I have the following problem. I want the axes (only the y-axis, to be >>> exact) >>> of a imshow() graph to be nonlinear. By default, the axis goes linearily >>> from 0 to (number of pixels). With the [extent] keyword, I can change >>> that >>> to going linearly from (arbitrary start) to (arbitrary end). Now, I'd >>> like >>> the axis to be dependend on a (bijective) arbitrary function, for example >>> y=p^2 (when p is the pixel number and y the y-axis coordinate). >>> How can I achieve this? >>> Thanks a lot, cheers >>> >>> Thomas >> >> See >> http://matplotlib.sourceforge.net/examples/pylab_examples/image_nonuniform.html >> >> Eric >> >> ------------------------------------------------------------------------------ >> Come build with us! The BlackBerry(R) Developer Conference in SF, CA >> is the only developer event you need to attend this year. Jumpstart your >> developing skills, take BlackBerry mobile applications to market and stay >> ahead of the curve. Join us from November 9 - 12, 2009. Register now! >> http://p.sf.net/sfu/devconference >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users@... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > -- > View this message in context: http://www.nabble.com/nonlinear-axes-for-imshow-tp25853828p25867951.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > ```
 Re: [Matplotlib-users] nonlinear axes for imshow From: thkoe002 - 2009-10-14 14:15:23 ```Hi JJ, thanks a lot for your help. I think that http://matplotlib.sourceforge.net/examples/axes_grid/demo_curvelinear_grid.html has everything I need, I'll try it out. The coordinates given by the mouse are off, but that seems to be the case even for the far more elaborate "custom scale/projection" example ( examples/api/custom_scale_example.py ), and it's not that important. Thanks, cheers Thomas >It depends on how far you want to go. > >* Manually setting ticks is a easiest solution, I guess. > >* The next step would be to create your custom tick locator & formatter > >http://matplotlib.sourceforge.net/api/ticker_api.html > >While this is not that difficult, you will need to spend some time. > >* axes_grid toolkit has limited support for arbitrary coordinate system. > >http://matplotlib.sourceforge.net/examples/axes_grid/demo_curvelinear_grid.html > >* create your own projection. > >http://matplotlib.sourceforge.net/devel/add_new_projection.html > >Unless you're familiar with matplotlib and some of it internals, the >last two options is not recommended. >Regards, > >-JJ -- View this message in context: http://www.nabble.com/nonlinear-axes-for-imshow-tp25853828p25891899.html Sent from the matplotlib - users mailing list archive at Nabble.com. ```