Ormond, Randy | 22 Jul 22:45

Plotting step functions

Hello again,

 

I’m looking for a way to plot step functions, i.e. lines with instantaneous changes in y values.

 

The histogram is close to what I need, but ideally I’d like to have only the tops of the rectangles.  I can also get close by plotting a series of single-value QwtPlotCurves, but then there is no vertical connection between the segments.

 

Can someone advise me?

 

Thanks,

Randy

256-319-6627

 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qwt-interest mailing list
qwt-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qwt-interest
David Stranz | 22 Jul 23:01

RE: Plotting step functions

Randy,
 
What's the problem with using curves where the two
consecutive x values at the step are the same?
 
x      y
0.0    1.0    start
1.0    1.0    horizontal
1.0    2.0    step up
2.0    2.0    horizontal
2.0    1.0    step down
3.0    1.0    horizontal
 
Should give you a step 1 y unit high by 1 x unit long.
Am I missing something in your question?
 
Regards,
 
David

_______________________________________________________________
David Stranz, Ph.D.     david_stranz <at> MassSpec.com

Sierra Analytics, Inc.
5815 Stoddard Road, Suite 601
Modesto, CA  95356

Tel: (209) 545-8508
http://www.massspec.com
_______________________________________________________________

 

From: qwt-interest-bounces <at> lists.sourceforge.net [mailto:qwt-interest-bounces <at> lists.sourceforge.net] On Behalf Of Ormond, Randy
Sent: Tuesday, July 22, 2008 1:49 PM
To: qwt-interest <at> lists.sourceforge.net
Subject: Plotting step functions

Hello again,

 

I’m looking for a way to plot step functions, i.e. lines with instantaneous changes in y values.

 

The histogram is close to what I need, but ideally I’d like to have only the tops of the rectangles.  I can also get close by plotting a series of single-value QwtPlotCurves, but then there is no vertical connection between the segments.

 

Can someone advise me?

 

Thanks,

Randy

256-319-6627

 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qwt-interest mailing list
qwt-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qwt-interest
Ormond, Randy | 23 Jul 00:01

RE: Plotting step functions

David,

 

Thanks, that works great. You weren’t missing anything, but clearly I was.

 

Thanks again,

Randy

256-319-6627

From: qwt-interest-bounces <at> lists.sourceforge.net [mailto:qwt-interest-bounces <at> lists.sourceforge.net] On Behalf Of David Stranz
Sent: Tuesday, July 22, 2008 4:02 PM
To: 'List for both Qwt users and developers'
Subject: RE: Plotting step functions

 

Randy,

 

What's the problem with using curves where the two

consecutive x values at the step are the same?

 

x      y

0.0    1.0    start

1.0    1.0    horizontal

1.0    2.0    step up

2.0    2.0    horizontal

2.0    1.0    step down

3.0    1.0    horizontal

 

Should give you a step 1 y unit high by 1 x unit long.

Am I missing something in your question?

 

Regards,

 

David

_______________________________________________________________
David Stranz, Ph.D.     david_stranz <at> MassSpec.com

Sierra Analytics, Inc.
5815 Stoddard Road, Suite 601
Modesto, CA  95356

Tel: (209) 545-8508
http://www.massspec.com
_______________________________________________________________

 

 

From: qwt-interest-bounces <at> lists.sourceforge.net [mailto:qwt-interest-bounces <at> lists.sourceforge.net] On Behalf Of Ormond, Randy
Sent: Tuesday, July 22, 2008 1:49 PM
To: qwt-interest <at> lists.sourceforge.net
Subject: Plotting step functions

Hello again,

 

I’m looking for a way to plot step functions, i.e. lines with instantaneous changes in y values.

 

The histogram is close to what I need, but ideally I’d like to have only the tops of the rectangles.  I can also get close by plotting a series of single-value QwtPlotCurves, but then there is no vertical connection between the segments.

 

Can someone advise me?

 

Thanks,

Randy

256-319-6627

 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qwt-interest mailing list
qwt-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qwt-interest
Uwe Rathmann | 23 Jul 07:31
Picon

Re: Plotting step functions

On Tuesday 22 July 2008 22:48, Ormond, Randy wrote:

> I'm looking for a way to plot step functions, i.e. lines with
> instantaneous changes in y values.

What's wrong with the QwtPlotCurve::Steps curve style ?

Uwe

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
David Stranz | 23 Jul 15:48

RE: Plotting step functions

Hi Uwe,

Didn't know about this.  It looks like QwtPlotCurve::drawSteps()
does internally that same thing I suggested to do manually; that
is, it duplicates each x or y point (depending on the inverted flag)
to create a step profile.

Thanks for bringing this to our attention.  I started using QwtPlot
only in the last few months, and I am impressed with the amount
of thought and work that you have put into it.  I have an ActiveX
control which does many of the same things that the QwtPlot / QwtPlotCurve
combination can do, but now I think I might replace it so I
can have an all-Qt solution.

It may need some optimization - I often have stick mode plots
with 250,000 sticks.  My ActiveX control is optimized to minimize
drawing calls when vertical sticks have the same x pixel coordinate,
and also performs its own internal clipping.  Otherwise, performance
is too slow.  I will try QwtCurve with and without optimization
to see how it compares.

Thanks for a good job.

Best regards,

David
_______________________________________________________________
David Stranz, Ph.D.	david_stranz <at> MassSpec.com

Sierra Analytics, Inc.
5815 Stoddard Road, Suite 601
Modesto, CA  95356

Tel: (209) 545-8508
http://www.massspec.com
_______________________________________________________________

> -----Original Message-----
> From: qwt-interest-bounces <at> lists.sourceforge.net 
> [mailto:qwt-interest-bounces <at> lists.sourceforge.net] On Behalf 
> Of Uwe Rathmann
> Sent: Tuesday, July 22, 2008 10:32 PM
> To: List for both Qwt users and developers
> Subject: Re: Plotting step functions
> 
> On Tuesday 22 July 2008 22:48, Ormond, Randy wrote:
> 
> > I'm looking for a way to plot step functions, i.e. lines with
> > instantaneous changes in y values.
> 
> What's wrong with the QwtPlotCurve::Steps curve style ?
> 
> Uwe
> 
> --------------------------------------------------------------
> -----------
> This SF.Net email is sponsored by the Moblin Your Move 
> Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & 
> win great prizes
> Grand prize is a trip for two to an Open Source event 
> anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> qwt-interest mailing list
> qwt-interest <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qwt-interest
> 
> 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Uwe Rathmann | 24 Jul 00:04
Picon

Re: Plotting step functions

On Wednesday 23 July 2008 15:48, David Stranz wrote:

> It may need some optimization - I often have stick mode plots
> with 250,000 sticks.  My ActiveX control is optimized to minimize
> drawing calls when vertical sticks have the same x pixel coordinate,
> and also performs its own internal clipping.  Otherwise, performance
> is too slow.  I will try QwtCurve with and without optimization
> to see how it compares.

QwtPlotCurve has an optimization flag to avoid painting duplicates, but this 
has no effect for the sticks style. 

But the best way to reduce the number of painted lines is to implement level 
of details inside of your QwtData class - depending on the current scales. 
Reducing the number of points is much more effective, than any optimizations 
you do while painting many points.

Uwe

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Ormond, Randy | 23 Jul 16:02

RE: Plotting step functions

Uwe,

   "...What's wrong with the QwtPlotCurve::Steps curve style ?"

Thanks, that's even better.  I just have to shift the y data over
relative to the x data so that the step occurs at the beginning of the
interval instead of the end:

// before
x << 0 << 1 << 2;
y << 0 << 10 << 20;

// now
x << 0 << 1 << 2 << 3;
y << 0 << 0 << 10 << 20;

I'm really enjoying getting back into Qwt.  Thanks for all the hard
work.

Thanks again,
Randy
256-319-6627

-----Original Message-----
From: qwt-interest-bounces <at> lists.sourceforge.net
[mailto:qwt-interest-bounces <at> lists.sourceforge.net] On Behalf Of Uwe
Rathmann
Sent: Wednesday, July 23, 2008 12:32 AM
To: List for both Qwt users and developers
Subject: Re: Plotting step functions

On Tuesday 22 July 2008 22:48, Ormond, Randy wrote:

> I'm looking for a way to plot step functions, i.e. lines with
> instantaneous changes in y values.

What's wrong with the QwtPlotCurve::Steps curve style ?

Uwe

------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qwt-interest mailing list
qwt-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qwt-interest

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

Gmane