Results 1 to 2 of 2

Thread: QwtPlot3D: how to cope with such a thing (picture inside)

  1. #1
    Join Date
    Nov 2008
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows

    Default QwtPlot3D: how to cope with such a thing (picture inside)


    How to make those lines shorter? I didn't find how to do it...

  2. #2
    Join Date
    Sep 2009
    Posts
    57
    Thanks
    7
    Thanked 5 Times in 4 Posts

    Default Re: QwtPlot3D: how to cope with such a thing (picture inside)

    See: http://sourceforge.net/projects/qwtp.../topic/3266089

    You can set the tic length for each axis X1,X2,X3,X4,Y1,Y2,Y3,Y4,Z1,Z2,Z3,Z4 but take care to use the world coordinates. You shoukd be mindful of the current scaling for X/Y/Z (setScale) and set the tic length according to the tic orientation (setTicOrientation).

    Its a bit fiddly but you'll get there in the end, here is an example from my code (xscale/yscale/zscale are factors that are used to scale each dimension, are doubles and have values as diverse as 0.001 through 1000.

    Qt Code:
    1. plot.setScale(xscale, yscale, zscale);
    2. plot.coordinates()->axes[Z1].setTicLength(25.0/xscale, 10.0/xscale);
    3. plot.coordinates()->axes[Z2].setTicLength(25.0/xscale, 10.0/xscale);
    4. plot.coordinates()->axes[Z3].setTicLength(25.0/xscale, 10.0/xscale);
    5. plot.coordinates()->axes[Z4].setTicLength(25.0/xscale, 10.0/xscale);
    6. plot.coordinates()->axes[X1].setTicLength(25.0/yscale, 10.0/yscale);
    7. plot.coordinates()->axes[X2].setTicLength(25.0/yscale, 10.0/yscale);
    8. plot.coordinates()->axes[X3].setTicLength(25.0/yscale, 10.0/yscale);
    9. plot.coordinates()->axes[X4].setTicLength(25.0/yscale, 10.0/yscale);
    10. plot.coordinates()->axes[Y1].setTicLength(25.0/xscale, 10.0/xscale);
    11. plot.coordinates()->axes[Y2].setTicLength(25.0/xscale, 10.0/xscale);
    12. plot.coordinates()->axes[Y3].setTicLength(25.0/xscale, 10.0/xscale);
    13. plot.coordinates()->axes[Y4].setTicLength(25.0/xscale, 10.0/xscale);
    14. plot.coordinates()->axes[X1].setTicOrientation(0, -1, 0);
    15. plot.coordinates()->axes[X2].setTicOrientation(0, -1, 0);
    16. plot.coordinates()->axes[X3].setTicOrientation(0, 1, 0);
    17. plot.coordinates()->axes[X4].setTicOrientation(0, 1, 0);
    18. plot.coordinates()->axes[Y1].setTicOrientation( 1, 0, 0);
    19. plot.coordinates()->axes[Y2].setTicOrientation(-1, 0, 0);
    20. plot.coordinates()->axes[Y3].setTicOrientation(-1, 0, 0);
    21. plot.coordinates()->axes[Y4].setTicOrientation( 1, 0, 0);
    22. plot.coordinates()->axes[Z1].setTicOrientation( 1, 0, 0);
    23. plot.coordinates()->axes[Z2].setTicOrientation( 1, 0, 0);
    24. plot.coordinates()->axes[Z3].setTicOrientation(-1, 0, 0);
    25. plot.coordinates()->axes[Z4].setTicOrientation(-1, 0, 0);
    To copy to clipboard, switch view to plain text mode 

    In fact perhaps to help, here is my code to calculate the xscale/yscale/scale, based upon minmax values

    Qt Code:
    1. double xscale, yscale, zscale;
    2.  
    3. if ((maxbinx-minbinx) >= (maxbiny-minbiny) && (maxbinx-minbinx) >= (maxz-minz)) {
    4. // scale is set off the x-axis
    5. xscale = 1;
    6. yscale = (maxbinx-minbinx)/(maxbiny-minbiny);
    7. zscale = (maxbinx-minbinx)/(maxz-minz);
    8. } else if ((maxbiny-minbiny) >= (maxbinx-minbinx) && (maxbiny >= minbiny) >= (maxz-minz)) {
    9. // scale is set off the y-axis
    10. xscale = (maxbiny-minbiny)/(maxbinx-minbinx);
    11. yscale = 1;
    12. zscale = (maxbiny-minbiny)/(maxz-minz);
    13. } else {
    14. // scale is set off the z-axis
    15. xscale = (maxz-minz)/(maxbinx-minbinx);
    16. yscale = (maxz-minz)/(maxbiny-minbiny);
    17. zscale = 1;
    18. }
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to liversedge for this useful post:

    olaks (28th January 2010)

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
  •  
Qt is a trademark of The Qt Company.