1. How to use pplot with ruby?
    1. Demo
    2. Differences with c++

How to use pplot with ruby?


A PPlot can be controlled from ruby scripts in almost the same way as in C++, see how to use pplot. You already have simple plot like this

% obtain a reference to the current pplot in a native widget calling this script
plot=GetCurrentPPlot
% make x/y arrays for one plotitem
xdata=[-1,0,1,2]
ydata=[3,4,1,2]
% add to plot
plot.mPlotDataContainer.AddXYPlot (xdata, ydata)
that's all! For more details, again, see the C++ documentation, but to give you an idea
% turn on grid
plot.mGridInfo.mXGridOn=true
plot.mGridInfo.mYGridOn=true

%set log scale for Y-axis
plot.mYAxisSetup.mLogScale=true

% widen up the borders
plot.mMargins.mLeft=50
plot.mMargins.mTop=50

% etc.

Demo

If you have qt, you can build the qpplotdemo in the qt directory. Strart it like this
     qpplotdemo -ruby
It should look like this.

Differences with c++



SourceForge Logo