Plotting Equations that Bifurcate
Alex Tweedly
alex at tweedly.net
Wed Nov 4 20:28:11 EST 2020
Hi,
gmSetCustomMarker is the first gm Library handler called in the demo app
- so it sounds like the library isn't being downloaded or set up properly.
I found one combination of browser and laptop here where the
.livecodescript file is displayed as though it were a text file, rather
than being downloaded! No idea why !!
So, I've uploaded a ZIP archive. Visit
https://www.tweedly.org/lcms.lc/GraphMaker again, and use the archive
link to download the zip fie and decompress it. Then open the demo app
in the IDE.
In the IDE, you could set a breakpoint in 'openstack' on card 1 of the
demo app, and verify that the library is being properly found in the
'start using tt' line, e.g. by checking the stacksinuse just after it.
If the library is properly loaded, then the "can't find handler
gmSetCustomMarker" problm should disappear.
Cool - I'll go take a look at CoupDeGraph.
I've been wondering how you handle multi-bifurcating functions - but
that'll be a separate email (after I've looked at CoupDeGraph :-)
Alex.
On 04/11/2020 18:09, Roger Guay via use-livecode wrote:
> Hi Alex,
>
> Thanks for your continued interest in my little project. I have succeeded in implementing a multiple polygon approach, but it ain’t elegant as they say!
>
> I seem to recall that I learned a lot from your GraphMaker some time ago, but as I try to review your latest on your website, I run into repeated errors about “can’t find handler gmSetCustomMarker”. I can’t seem to make any headway to resolve this. Am I supposed to do something with the “Library”? I could not find instructions anywhere.
>
> Meanwhile, I should explain further that I am trying to expand on a stack that I built 2 or 3 years ago called CoupDeGraph which you can find in the Example Stacks of LiveCode. Put simply, I am currently trying to expand on CoupDeGraph to be able to handle double-valued equations.
>
> Again, thanks for your help
>
> Roger
>
>> On Nov 3, 2020, at 4:48 PM, Alex Tweedly via use-livecode <use-livecode at lists.runrev.com> wrote:
>>
>> On 31/10/2020 02:28, Roger Guay via use-livecode wrote:
>>
>>> Lots of clever ideas here, Alex, but I think you’re missing the point of what I ultimately want to do. I'm building a plotting program for which I want to plot any equation including those that have multiple values of y for a given x. An equation might branch at any point and might even have multiple branches both of which are unknown before plotting.
>>>
>>> Of course, there’s always the possibility that I’m not fully comprehending your suggestions??? What does NB stand for? Are you suggesting creating a new polygon every time a branch is detected? That just might work?!
>> Hi Roger. You're right - I missed the point; I jumped to the assumption that you were asking about a fairly small, specific issue - so leapt too quickly to a code sample. But before I address the general question(s), let me get the little points out of the way :-)
>>
>> NB - sorry, kind of common usage in British English. Actually, it's from a Latin phrase - "Nota Bene" - meaning "note well". So basically just 'take note of'.
>>
>> "a new polygon every branch" - yes, perfectly possible. Also possible is what I did in the first case of the code sample - a new 'sequence of points' for each branch, and then stitch those together (with blank lines between) into a single polygon; but that's, for now, a detail.
>>
>> The essence of the problem is that your app will (somehow) develop a number of 'sequences of *data* points' - and then those need to be translated into equivalent sets of *display* points (by either a plotting library, or by your own code) to allow it to be displayed appropriately.
>>
>> There are at least two possible plotting libraries that might do what you want (or do something close enough that they could be useful). By coincidence, they were both discussed at the San Jose LC conference in 2019.If you have access to the video / papers from that you might already have some of the info you need; I don't know if the conference papers are ever put out for more general usage later.
>>
>> Option A. Monte described a wrapper for the JSPlot library. It's a very powerful library capable of many kinds of graphs / plots, and very quick and capable. The most obvious downside is that it needs to be used within a browser widget - but well worth looking at it if you can.
>>
>> Option B. I did a library called "GraphMaker" - a pure-Livecode plotting library. It is (I think) fairly easy to use - but that may not be the case for someone else coming to it new. I know it can handle this case of bifurcating plots (using multiple sequences of data points). The conference slides were a decent, if very brief, introduction; the lengthier documentation was, maybe, not quite complete. However, it does come with a demo app that uses the library to draw a variety of graph types. Main advantage is it's pure LC, and hopefully easy to use - both in understanding and in ease of integration into an app (you just create a suitable group to contain the graph, set its rect properly and pass in all the point data along with various parameters. It has nowhere near the coverage of different graph types that JSPlot does - it's basically line, bar and scatter plots, with primary X-axis, and can have shading, etc.
>>
>> Option C. Roll your own.
>>
>> I'd certainly suggest investigating the use of an existing library first. There's quite a lot of effort needs to go into determining how to scale the data to the space available, how to label the axes, how to add tick marks, grid lines and (perhaps) multiple Y-axes. That stuff probably accounted for 90% of the effort of creating the library.
>>
>> If you'd like to try out my library, the latest version can be found at
>>
>> https://www.tweedly.org/lcms.lc/GraphMaker
>>
>> (sorry - I haven't formatted it into my usual download structure - so this is simply a page that gives links that allow you to download the 2 files you need and 2 more files you don't need.)
>>
>> Of course, I'll be happy to help out in any way I can with it.
>>
>> Alex.
>>
>> P.S. the demo app includes an example of a 'branching' plot (Graph 3).
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list