Results 1 to 4 of 4

Thread: how to create a colorful scatter plot ?

  1. #1
    Join Date
    Jun 2013
    Posts
    56
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default how to create a colorful scatter plot ?

    Hi
    Uwe ,
    could you give me some advice about how to create a colorful scatter plot ?
    the colors represent the third dimension .
    I have made a subclass from QwtPlotCurve,and implemented draw().
    But I wonder if there is another way based on qwt6.1 to make my application achieve a better performance .
    Thanks.

    Nicho

  2. #2
    Join Date
    Jun 2012
    Posts
    173
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    48
    Thanked 2 Times in 2 Posts

    Default Re: how to create a colorful scatter plot ?

    have alook at QwtPlotSpectroCurve, maybe will do wat you want.

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

    Nicho (18th July 2013)

  4. #3
    Join Date
    Jun 2013
    Posts
    56
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Re: how to create a colorful scatter plot ?

    Quote Originally Posted by jesse_mark View Post
    have alook at QwtPlotSpectroCurve, maybe will do wat you want.
    thank you , Jesse
    i have taken a look at that class .
    it seems like what i have done in my subclass .
    and in my way,the performance comes down at the amount of tens of thousand of points or even more .

    Nicho

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

    Default Re: how to create a colorful scatter plot ?

    The scatterplot example shows a very fast implementation, that uses a couple of tricks, that are not possible for all types of scatter plots.

    a) Points are rendered to a QImage by copying a RGB value to memory ( no QPainter involved )
    b) Because of a) it is possible to render multithreaded

    a) is only possible because the scatter plot example uses a 1 pixel dot for each point. For any other type of symbol you would need some render code that sets the pixels ( like QPainter does ), what will slow down the operation. When using a non opaque pen you would also have to manipulate the alpha value, when several points are on the same position.

    When having different colors b) might be a problem, because the order of how points are rendered will be arbitrary.

    Nevertheless mapping a z value to a RGB value will slow down the operation. But this mapping doesn't necessarily be done inside of the render loop repeated for every replot.

    One comment on your code: when you really have a significant performance issue with about ~10000 points there must be something wrong. Do you notice the same bad performance when using QwtPlotSpectroCurve ( try an antialiased pen with a width of 1 ) ?

    Uwe

Similar Threads

  1. How to I create a scatter plot using qwt?
    By jtso8 in forum Qt Programming
    Replies: 1
    Last Post: 16th January 2012, 12:21
  2. how to plot scatter graph?
    By rambo83 in forum Qwt
    Replies: 0
    Last Post: 25th February 2010, 13:24
  3. Scatter plot with custom symbols
    By jcox23 in forum Qwt
    Replies: 4
    Last Post: 5th February 2010, 13:54
  4. Scatter plot with many colors
    By DKL1972 in forum Qwt
    Replies: 4
    Last Post: 29th June 2008, 12:15

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.