Results 1 to 3 of 3

Thread: Arbitrary X-Axis Scale Using Equation?

  1. #1
    Join Date
    May 2009
    Posts
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Arbitrary X-Axis Scale Using Equation?

    I have a plot where I would like to set an arbitrary scale on the X-axis (defined using a linear equation). How can I achieve this?

    More details:
    I have a spectrum, where the X-axis is "channels" (integers, from 0-2048 or however many channels are present) and the Y-axis is "counts". I would like to convert the X-axis scale to "energy" (channel converted to energy, using a linear equation). I've been experimenting with inheriting QwtTransform, defining the virtual methods transform() and invTransform(), then setting
    Qt Code:
    1. this->axisScaleEngine(QwtPlot::xBottom)->setTransformation(new MyTransform())
    To copy to clipboard, switch view to plain text mode 
    but to no avail. Am I on the right track?

    Thanks!

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Arbitrary X-Axis Scale Using Equation?

    QwtTransform is for the mapping between the axis and widget coordinate systems, but you are looking for mapping the x coordinates of your samples into the coordinate system of your x axis - that's a different one !
    Don't know about the details of your project, but to me it looks like you should set up your plot coordinate system based on energy. The mapping of your samples would be done then by overloading methods of QwtSeriesData<QPointF> to return energy.

    Uwe

  3. #3
    Join Date
    May 2009
    Posts
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Arbitrary X-Axis Scale Using Equation?

    Thanks for the reply, Uwe. I've gone with that approach and just mapped the new values, then replot - seems to be working!
    Cheers

Similar Threads

  1. Replies: 1
    Last Post: 9th September 2013, 08:50
  2. qwt axis scale
    By Markus_AC in forum Qwt
    Replies: 0
    Last Post: 15th December 2011, 10:45
  3. Replies: 10
    Last Post: 21st September 2011, 09:03
  4. Replies: 4
    Last Post: 16th January 2011, 11:32
  5. Replies: 1
    Last Post: 15th December 2010, 12:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.