forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Saving smoothed data

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
DanRRight



Joined: 10 Mar 2008
Posts: 2411
Location: South Pole, Antarctica

PostPosted: Tue Aug 24, 2021 9:07 pm    Post subject: Saving smoothed data Reply with quote

Suppose you have few (x,y) points. You plotted X-Y graph with %PL, chose Designer Mode Plot Parameters/Line Style /Splines, adjusted smoothing parameter so that the line looks perfectly smooth. Now is it possible somehow to save the smoothed data with your chosen X step? Definitely %PL keeps smoothed data somewhere inside
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7068
Location: Salford, UK

PostPosted: Wed Aug 25, 2021 8:56 am    Post subject: Reply with quote

The native %pl provides access to the Microsoft GDI+ library. It does not create data for points on the curve between those supplied by the user.

I don't know if the GDI+ library provides functions for interpolation. If not then a back-handed approach would be to detect the colour change directly from the plotted curve.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2411
Location: South Pole, Antarctica

PostPosted: Wed Aug 25, 2021 9:39 pm    Post subject: Reply with quote

Paul,
May be my smoothing wording confused you. I meant not the antialiasing but the spline smoothing with the tension parameter used in the %PL. I meant returning of plotted data back to the user as usual set of x,y points. This data definitely differs from initial one

The user may supply initially just 3-4 (x,y) points. When the %PL smoothing it with its splines the plot has many points in between. Getting back the entire plotted graph as usual (x,y) set is clearly missing feature (if i don't miss something and such functionality already exist)

Currently i digitize the resulting smoothed plot but definitely it is better if %PL was able just to save the plotted data. This is my suggestion for new feature if it's indeed missing.

/* By the way my Digitizer program is 100% written in FTN95. It reads drag-and-dropped BMP image, finds the color of plotted curves you select and scaling curves back into numbers. All the work done using just the mouse clicks, you just set four X and Y axis numbers with the keyboard for it to convert pixel coordinates into actual values. I can upload this program to everybody but it has now one small problem: before it was reading any graphics formats FTN95 allows, like PCX, JPG, TIF, GIF etc but i made the bug somewhere long ago and now lazy to fix it.
You see below how magnifier works for exact positioning on right places. Digitizing programs are a must for everyone, they are extremely useful. FTN95 allows to create them the way they fit you.

Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7068
Location: Salford, UK

PostPosted: Thu Aug 26, 2021 7:23 am    Post subject: Reply with quote

Dan

I understood your question correctly and my reply is the same. %pl passes your data points on to the GDI+ library. It does not interpolate and add new data points. It is the GDI+ library that does the plotting based on your data points and your selection of the spline tension.

There might be a GDI+ function that provides interpolated values from your data points and spline tension for a given value of x (say, assuming your curve is one to one), but I don't think that ClearWin+ can help you here.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2411
Location: South Pole, Antarctica

PostPosted: Thu Aug 26, 2021 6:40 pm    Post subject: Reply with quote

I'm surprised that some thirdparty library is used for the plottiing. As a result no one now can do elementary thing like printing the plotted data back to the user. Is this at least Microsoft's own child? Otherwise I'd think native PL in the long run will be screwed if not doomed because all graphics libraries have life span just few years unless they are used by the major players like MS, Linux, Android, Apple and gamers

How to contact developers of this GDI+ software and ask them if they plan to implement saving graphics data to ASCII ?


Last edited by DanRRight on Fri Aug 27, 2021 2:19 am; edited 1 time in total
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1556

PostPosted: Fri Aug 27, 2021 12:41 am    Post subject: Reply with quote

Dan, GDI+ is a Microsoft Windows component, please see https://docs.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-drawing-cardinal-splines-use for an explanation of splines under tension as implemented in GDI+.

I have never used GDI+ directly, but the linked page suggests to me that the interpolated points are generated just prior to displaying the curve on the output device (monitor screen, etc.), so their count and x-y values are not fixed and not made available to the user.

If you wish to generate your own interpolated points, look into Akima, Lowess and other such schemes. To get a feel for what Akima interpolation does, see https://www.source-code.biz/snippets/typescript/akima/ . Akima interpolation is available in Fortran. See Netlib TOMS #697. Akima interpolation is implemented in R, see https://cran.r-project.org/web/packages/akima/index.html .
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2411
Location: South Pole, Antarctica

PostPosted: Fri Aug 27, 2021 3:35 am    Post subject: Reply with quote

Thanks Mecej4. I'd still try to contact Microsoft first about output to ASCII since it would be so nice to have this functionality in the %PL. If they say NO, then would be good if Paul implemented this algorithm in %PL so that we would be able to print the plotted data. This printing to file plotted data functionality is a must in %PL anyway.

Meantime may be someone will make a small demo? I'm too busy right now to experiment. I like approach Mecej4 suggesting because it is always better to not depend on thirdparty. For example with thirdparty GDI+ you can not make such plots like below which look good for advertisements but with mecej4's approach it is 5 minutes job


Last edited by DanRRight on Fri Aug 27, 2021 8:02 am; edited 1 time in total
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7068
Location: Salford, UK

PostPosted: Fri Aug 27, 2021 7:53 am    Post subject: Reply with quote

The GDI+ drawing functions are listed here...

https://docs.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-graphics-flat
Back to top
View user's profile Send private message AIM Address
mecej4



Joined: 31 Oct 2006
Posts: 1556

PostPosted: Fri Aug 27, 2021 4:56 pm    Post subject: Reply with quote

Dan, I cannot make sense of your attached image. It seems to be a picture of part of the screen of a cell phone or tablet computer. You wrote, "plots like below", but the only plots that I can see are postage stamp sized plots of stock prices, which we do not expect to be smooth curves at all.
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2411
Location: South Pole, Antarctica

PostPosted: Fri Aug 27, 2021 5:13 pm    Post subject: Reply with quote

You are right ,Mecej4, i often 5 min later myself do not understand what i wrote. I meant that if you have your own not third party software, you can easier add any tricks to it by any wildest demand - like, for example, these gradient backgrounds under the plots
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group