Results 1 to 6 of 6

Thread: Plot sizes very dependent on the labeling of axes

  1. #1
    Join Date
    Sep 2007
    Posts
    61
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Plot sizes very dependent on the labeling of axes

    If you have an excessive number of major ticks (or a step size such that there will be a number of major ticks), you can get an excessively large plot.

    For instance, if I change the number of major steps to 30 in the playground/timescale example (line 14 of mainwindow.cpp), I will have a very large plot which can not be made smaller regardless of what you change the settings to. However, if I start with a smaller number and raise to 30 via GUI, it seems to be able to compensate for this just fine.

    My own program has an issue where I would like to set the step size to a certain number, but want it to keep the plot to a more reasonable size and maybe display only a few of the labels. What is the best way to accomplish this?

    Thanks,
    Joey

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

    Default Re: Plot sizes very dependent on the labeling of axes

    Quote Originally Posted by bigjoeystud View Post
    My own program has an issue where I would like to set the step size to a certain number, but want it to keep the plot to a more reasonable size and maybe display only a few of the labels. What is the best way to accomplish this?
    Sound like you want to set your step size as minor step size.

    F.e. if you want to have a step size of 1 and tick labels every 10 ticks:

    Qt Code:
    1. plot->setAxisMaxMinor( 10 );
    2. plot->setAxisScale( min, max, 10.0 );
    To copy to clipboard, switch view to plain text mode 

    Uwe

  3. #3
    Join Date
    Sep 2007
    Posts
    61
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Plot sizes very dependent on the labeling of axes

    I tried that and I still get a very large plot. That's really the problem I'm trying to solve. I want my plot to be more or less the same size if I had 8 labels.

    I guess my problem is I really want (in my current case) to have a step size of 13. My scale goes from 0 to 390, so there are special labels every 30th label. If I set my major ticks to 30, I see the result I want, but the plot is huge! If I create a plot with the defaults, but then bump up my number of ticks to 30 with the GUI, I get the same default size plot, but with more labels.

    In the timescale example, if you change line 14 of mainwindow.cpp to show 30 ticks, the effect seems to be the same. It creates a very large plot to make room for all the labels. If I start with 8 labels (the default), and then use the GUI to go up to 30, I get all the labels, but the plot has stayed the same size.

    Hope that makes sense!

    Joey

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

    Default Re: Plot sizes very dependent on the labeling of axes

    Quote Originally Posted by bigjoeystud View Post
    I guess my problem is I really want (in my current case) to have a step size of 13. My scale goes from 0 to 390, so there are special labels every 30th label.
    Then don't try to configure a algorithm to calculate a special scale, when you know it in advance. Instead use QwtPlot::setAxisScaleDiv().

    Uwe

  5. #5
    Join Date
    Sep 2007
    Posts
    61
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Plot sizes very dependent on the labeling of axes

    I'm sorry, but I'm totally lost now! How does that help the plot become smaller?

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

    Default Re: Plot sizes very dependent on the labeling of axes

    A scale is always defined by a QwtScaleDiv object ( = boundaries + tick positions ). You can setup one manually or use a scale engine ( this is what internally happens, when you use setScale() ) to calculate a QwtScaleDiv object for you. When the result of the scale engine is not what you need and you know where you want to have the ticks you better build the QwtScaleDiv object on your own.

    In your case you could set the boundaries to [ 0, 390 ] the major ticks at 0, 30, 60, ... 390 and the minor ticks maybe at 10, 20, 40, 60 ...

    As the tick labels ( always on major ticks ! ) are the reason for your layout problem the minimum size of the plot will be smaller when you have less major ticks.

    HTH,
    Uwe

Similar Threads

  1. Labeling a curve
    By kalgorithmist in forum Qwt
    Replies: 2
    Last Post: 10th May 2011, 21:06
  2. Plot Axes
    By mcarter in forum Qwt
    Replies: 0
    Last Post: 4th December 2009, 23:47
  3. Labeling scatter plot points
    By hamid ghous in forum Qwt
    Replies: 1
    Last Post: 29th October 2009, 06:35
  4. Replies: 2
    Last Post: 4th August 2008, 08:14
  5. Platform dependent source files: what is best?
    By ucomesdag in forum Qt Programming
    Replies: 5
    Last Post: 27th November 2006, 18:52

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.