apple / swift-numerics

Advanced mathematical types and functions for Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plotting module

wigging opened this issue · comments

A plotting module would be a great component of Swift Numerics. And since this is Swift, a plotting module could utilize Metal for high performance visualization and animation. The Python community provides many examples of plotting libraries such as Matplotlib, Plotly, HoloViews, and many more.

Will that rely on the graphics library?

@SusanDoggie I'm not sure I understand your question. What do you mean by "rely on graphics library"? There are many ways that Swift could generate plots. A plotting module for Swift would provide a simple interface to generate those plots. The underlying functionality of such a module would use things like Core Graphics, Core Animation, Metal, SwiftUI, etc. But the main API to create a plot would be something as simple as plot.line([4, 5, 9, 12, 8, 2]). I can work on a SwiftUI example code if that would help clarify things.

A plotting library would certainly be useful. While related to numbers, however, it's really its own separate library. It will likely need to depend on the numerical APIs developed here, but that doesn't make it of a kind with them.

Core Graphics, Core Animation, Metal, SwiftUI

@wigging The difficulty here is that all of the above is not open source. Of course, it would be nice if Apple eventually opened SwiftUI.

Different backends could be used to support platforms other than Apple. For example, Matplotlib uses GTK, Qt, Wx, Tk, etc. for creating plot figures on Mac, Windows, or Linux.

@SusanDoggie I'm not sure I understand your question. What do you mean by "rely on graphics library"? There are many ways that Swift could generate plots. A plotting module for Swift would provide a simple interface to generate those plots. The underlying functionality of such a module would use things like Core Graphics, Core Animation, Metal, SwiftUI, etc. But the main API to create a plot would be something as simple as plot.line([4, 5, 9, 12, 8, 2]). I can work on a SwiftUI example code if that would help clarify things.

As you mentioned, the plotting module depends on the graphics library. When you consider cross platform, it's may not have any usable graphic libraries pre-installed. Such as ubuntu for docker. Separated plotting library for a specific platform may be an option.

However, I have my own library which doesn't depend on any system graphics library.
https://github.com/SusanDoggie/Doggie

Would it be better to have a swift-plotting project instead of having plotting functionality as part of swift-numerics?

I'm going to go ahead and say this is out-of-scope for Swift Numerics, at least for the foreseeable future. I want to keep this library fairly tightly focused. That's not to say that this isn't an important project, or an exciting thing to work on; it's just not appropriate for this package at this point.

That's fine. Thought I would at least suggest it.

@stephentyrone Should this issue be left open for future discussion or should I go ahead and close it?

I think you can go ahead and close it. Thanks!