LabPlot2 for kde-edu?
Alexander Rieder
alexanderrieder at gmail.com
Mon Jan 6 00:51:30 UTC 2014
Hi,
sorry for the somewhat late reply.
On Wednesday 01 January 2014 16:52:01 Alexander Semke wrote:
> Hi,
>
> > Hi,
> > I'm the maintainer of Cantor.
> > As Aleix already pointed out, the requirements for joining the KDE family
> > are quite low, and I'd like to encourage you to join.
> > I agree that there are could be some interesting possible cooperation
> > between Cantor and LabView.
> > For example at the moment most(all, since I still owe Aleix the
> > integration
> > of the kalgebra-QML-item branch, sorry about that) of the plotting support
> > in Cantor is static (i.e. showing an image), and due to the way most
> > backends are implemented as separate processes this is hard to change.
> > Instead we could offer our own interactive plotting fallback for which the
> > backend only has to feed the data, which is much easier to do. What do you
> > think? Does LabView offer a simple API for cases like that?
>
> Yes. Let me give you more information. Currently, the worklflow in labplot
> is the following: you create a new project, worksheet, xy-plot and a
> xy-curve. Then you specify the data sets to be used for the x and for the
> y-data of this xy-curve. These data sources can originate from a
> spreadsheet where you type in the data by hand or where you import the data
> from an external ascii-file to the spreadsheet. So, in principle you just
> have to select a column. Internaly, such an Column object is just a wrapper
> over QList<double> (implementations for QList<QDateTime> etc. will follow
> in the next months). We just need to fill such Columns. At the moment, the
> labplot-user selects in a tree-like ComboBox the columns. Columns belong in
> this tree-hierarchie to Sreadsheets. Now, my idea was to integrate/embed
> Cantor into LabPlot. The user creates, e.g., a Maxima-session in LabPlot
> and performs some calculaitons leading to some arrays or lists or however
> these objects are named in the specific CAS where the results for the plots
> are stored. These arrays/lists we need to expose from Cantor to LabPlot.
> Then, the user selects in the ComboBox the Maxima-session and one of its
> children (array/list with the actual data) as the source for x- or y-data.
> By having this, we can combine the data originated from different sources -
> imported from an ascii-data, provided by hand in a spreadsheet or
> caclulated in maxima, octave etc.
>
There is a starting point for this is already present in the VariableModel
provided by some of the backends (including maxima). It gives you the
name+value of all variables in the session. The value might not be usable, as
it's meant to be in a human-readable format, but if you provide a simple
function that outputs the value in an easily parseable format
this should be quite simple to implement (on the cantor side of things).
> So, this was a LabPlot-centric suggestion where Cantor would "just" take a
> role of an additional data provider for the plots. Consider now the Cantor-
> centric way of thinking. You create a plot and want to easily edit plot
> features. As you said, you show currently a static picture generated by a
> different framework. For this you could use something like QCustomPlot which
> is Qt-based, can be embedded in any project and provides a lot of features
> and a clean interface. But then you still need to implement a lot of
> GUI-stuff when you want to provide easy ways of editing of the plot
> appearence. This is where LabPlot can help since a lot of GUI-stuff for
> everything you see on the plot (or worksheet in general) is already
> available. The only problem here I see now is the fact that you need to
> create first a worksheet and then a plot. Internaly, worksheet provides you
> a QGraphicsScene/View and a plot inherits from QGraphicsItem. So, you
> create a worksheet and then a plot with axes and curves, activate a layout
> with zero margins and embed this QGraphicsView into you session-widget
> instead of a static picture. LabPlot's worksheet is shown within another
> widget instead of being an MDI-sub-window. And then you need to embed all
> LabPlot's dock widgets...
> LabPlot's API is simple. As an example take a look at
> CartesianPlot::initDefault() here
> https://sourceforge.net/p/labplot/code/HEAD/tree/2.0/src/backend/worksheet/p
> lots/cartesian/CartesianPlot.cpp You can also have a look at Axis.h or at
> XYCurve.h if you want to see which properties of these object can be
> modified. But it's easier to compile and to install LabPlot and to give it
> a try :-)
>
I'll have a closer look at these things when I have some free time, but it
sounds promising.
> Just thought a bit longer about this... I think, it would be easier to use
> Cantor within LabPlot then the other was around if you want to have all the
> editing properties currently available with everything being
> undoable/redoable etc. In the long term, I can think of LabPlot being, with
> the help of Cantor, a complete and feature-rich frontend to different
> CASes. LabPlot provides you a "project explorer" where you have an overview
> of all objects you've created. On the screenshots in Stuart's blog you see
> this project explorer on the left hand side. Having a maxima-session for
> example, you would have a parent node in the project explorer for this and
> as children nodes you could have all your variables, expressions,
> equations, inputs, plots, tables etc so you can easily navigate through
> your session. The middle part of LabPlot is the place for the actual
> "content" - worksheet, spreadsheet, CAS-sessions, text editor windows for
> scripting stuff. On the r.h.s you have the dock widgets were you can edit a
> lot of properties of the currently selected object (or objects, yes, you
> can edit multiple object of the same type simultaniously - say, you can
> edit the line width of ten curves in a single step). For CAS one could show
> here the context related documentation. Something similar you already have
> in Cantor.
I really like the idea. It sounds extremely powerful and awesome. Hopefully we
can make this happen.
> > As far as using Cantor to integrate other CASes, if you have a look at
> > cantor/src/lib you see that internally Cantor is designed very modular
> > and
> > provides a library which abstracts away all the backend specifics and is
> > independent of the worksheet ui. You can just send a command and get the
> > results. This should give you a simple access to all the different
> > languages supported. (Although for big amounts of data it might be
> > necessary to come up with something faster than using stdout+parsing). If
> > you're interested in trying it out, feel free to ask me anything.
>
> I don't intend to integrate new CASes. Maxima and Octave as additional data
> providers within LabPlot at the beginnig would be more than greate :-)
> Serializing/deserializing of data is, I think, good enough at the beginning.
>
>
> Best regards
> Alexander
>
> P.S.: Just wanted to try out plotting in Cantor, but I failed to produce a
> plot in Maxima with plot2d(sin(x),(x,-1,1)) - I get an image with a lot of
> mess. Cannot send the screenshot here since there is a size limit on this
> mailing list... Cantor crashes if I try to replot this a couple of time. I
> can fill a bug report, if this is an unknown problem. If I add an
> additional $ at the end of the line, the plot appears in an external
> window.
What version of libspectre/ghostscript are you using? There used to be bug
https://bugs.kde.org/show_bug.cgi?id=319053, can you try setting LANG=C as
suggested in one of the comments there? If that doesn't help, can you send me
the screenshot and the debugging output cantor gives you to my email adress?
best regards,
Alexander
More information about the kde-edu
mailing list