Pre-release of a new plotting objective-c framework

Hi,

I have been browsing this website for a while (including the very nice cocoa for scientists articles) but did not register until today, so this is my first post here.

As a former linux user, and a switcher to mac for nearly two years, I decided to go native cocoa/objective-c coding, losing such libraries as Qwtplot in the process... As I couldn't find a suitable framework for my needs, which include plotting strange attractors with many, many points in a reasonable time and reasonable memory requirements, I decided, a couple of weeks ago, to write a new framework for 2d plotting.

I just put online the result of my initial efforts, not because I think it is complete and full-featured, it is obviously not, but rather to have some feedback from scientists who might have a use of such a library.

There is much to be done, and I'll work on it a little time on a daily basis, focusing on the TODO list I posted, but taking into account suggestions that will be done here or via email.

Note that it is an opensource project, and I've chosen the simple MIT licence for distribution, and I suppose that as soon as the project comes a bit more mature, I'll try to put it on sourceforge or google code.

Documentation is mostly missing at this point, but I'll try to adress this issue as my first priority.

The framework and some information can be found there : http://www.mpkju.fr/~graphview

Every comment, encouragement, constructive criticism welcome !

Pierre-Henri Jondot

plotting framework

Merci Pierre-Henri!

That sounds very interesting, and you will probably learn a lot from that project too. Writing framework adds another dimension to writing code, because it makes you think more about design and APIs and encapsulation. By forcing yourself to be clear to others, you end up with better code too.

Please keep us updated, and if you ever feel like writing a plug or a tutorial on it (eventually), hit the Submit Story button on the top of the page, and send an email to one of us so we can approve the story for publication on the site.

charles

comments already

I quickly just looked at the Documentation and screenshots, it looks great and both powerful and nimble.

I had a couple of nitpicking comments:
* the behavior of right click on a Mac (and on Windows) is very much tied to contextual menu, so having the right click perform a zoom out will be a surprising behaviour for the user
* method naming normally should not include words like 'and' (see Apple's guidelines). Of course, these are just guidelines, and with autocompletion, not a big issue. But these little details and consistency are what make part of the Cocoa frameworks so nice to use (and inconsistencies make for the frustrating sides of it). And they are particularly relevant for frameworks.

Thanks for your comments,

Thanks for your comments, and especially your nitpicking... At this point it won't be much trouble to rename methods to not include 'and' and I will do so very soon. (I think I got this habit from the Kochan book...)

The right click will need a bit of thinking though. I will certainly keep the event handling modes I predefined, be it only for my sake, but I suppose I will split the mode in two parts : one part for the behavior of left clicks, dragging, and maybe one for right clicks that one can choose independently to offer an automatic contextual menu with (as with apple's Grapher) copy to clipboard to one or another picture format, or delegating to another class the content of the menu. (Keeping a non-apple-ish zoom out mode, as I just find it too convenient to not use it...)

Pierre-Henri

Nice Work

Hi Pierre-Henri,

I took a quick look at the docs, and the examples, and it looks like nice work, and very useful to the community.

The following comments are not directed at you, but are just general observations:

There are now 4-5 different open source plotting frameworks on the Mac. Most do one or two things well, but none are very complete. Usually, they are developed for a while, and then left to code-rot like so many open source projects. (I am as guilty of this as anyone; I developed one of the open-source frameworks.)

What I would like to see is a serious, open-source effort to develop a Cocoa plotting framework. (I doubt Apple will ever do it, because it is just too small a niche.) When I say 'serious', I mean more than one developer should be involved, and that the framework should be developed aggressively to a point where it is the obvious choice if you need to do plotting in a Cocoa app. And then it should be maintained.

Maybe MacResearch should be involved in organizing this, because it seems like the single biggest missing piece of the jigsaw for Cocoa scientific app development.

If you're interested in involving yourself in something like this, add a comment here.

Drew

---------------------------
Drew McCormack
http://www.maccoremac.com
http://www.macanics.net
http://www.macresearch.org

Right click or zoom

Obviously, it is more important for you to keep what you are used too, since you are the main (only?) user, and you want to please the users ;-)

But for the sake of discussion and to go one step further, I would suggest as one possible option that alt-click could be the zoom out, as this is the standard set by Adobe (maybe they were not the first, but certainly they make it a standard), and now seen in many other drawing apps (OmniGraffle, Pixelmator, ...). Just my extra 2 cents (thus 4 cents total so far!).

A serious graphing framework

Drew, that would be nice, yes.

I dunno what it takes exactly for this kind of project to be successful, but I would say:
(1) a dedicated leader that pushes things forward, and it does not have to be by coding, in fact, it probably is more useful to have a web site, a build system, some tutorials, documentation, and some PR.

(2) good APIs - which means pleasing a bunch of potential user. For a framework, it almost seems that you want to write the headers first, and work on them until all potential users are happy. And then only think of the implementation (kind of like you would first describe the UI and specs of a program, mock it up extensively, make sure it will do what the users need, and then write it). This can be a collaborative process

(3) have a 'killer' app that comes with it. That can help a lot, I would think. For a framework, you can have test suites, but nothing better than a real app that really needs to work and that is useful, to drive the developement and get bug reports and feature requests not just from users of the framework (the few developers that include it in their product), but from users of the apps that sit on top of the framework (many more people).

Maybe (2) could be done within MacResearch?

I quite agree, I am

I quite agree,

I am perfectly aware that if I am alone in this project I will spend a few weeks more making the framework better, then get bored and move on. I have no idea if it could serve as a basis for THE cocoa plotting framework, but I do think it has some potential. After all, one can already do a lot with a few lines of code in its very preliminary form.

So I can only hope that other developers, scientists will be interested enough to take a part in its development and I do intend to put it very soon in a SCM repositery (I think about sourceforge or google code, but if you have better ideas, they are welcome... At the moment, I just know nothing about working with cvs, svn, git or whatever...).

The first step maybe would be to create a mailing-list to discuss about this framework development. It looks that my account at infomaniak.ch that owns the framework's homepage allows me to easily add a mailing-list, but I don't suppose it could archive messages so I'll look elsewhere for that.

Let's make it big if I/we can ! cocoa needs it indeed (or else I wouldn't have taken the pain to write this preliminary draft of a framework... It is fun so far though...)

Pierre-Henri

Good tip, I just didn't know

Good tip, I just didn't know this shortcut... (I am not a real mac user yet... Just a convert !)

Apple's Grapher uses it too it seems,

EDIT : this is done. Now a right click shows a contextual menu, which for right now offers the possibility to copy to the pasteboard in TIFF, PDF or EPS formats, and the zoom out is performed with alt+right click. The code has been cleaned a bit and is closer to cocoa guidelines...

EDIT2 : I added three new PHGraphObjects children, for the drawing of lines given by cartesian equation, axis inside the view, the functions graphs (with on-demand calculation, no storing of points data).

Pierre-Henri

Some news, creation of a mailing-list

I will keep on working on this project for at least a few weeks more, but I will soon need guidance and support to make it more useful and complete.

It will help to not be bored too soon with it as well...

So I urge every scientist interested in developing cocoa applications to have a look at this framework and, if they think, like I do, that this project might have a future, to subscribe. There is a lot of design decisions to be made, and the project will only be better if there is some collaborating thinking and deciding...

phjo

P.S. : some new objects have been added. Have a look at the examples and the class hierarchy.

This looks very promising,

This looks very promising, thanks for developing it - I'll check it out soon. One note, isn't the name 'graphview' already taken for a plotting package?