
Security News
npm ‘is’ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
= BPlot
BPlot is a 2D and 3D plotting module for SciRuby. It provides an API familiar to Gnuplot users and to a lesser extent Matlab users.
\ /
\ o ^ o /
\ ( ) /
____________(%%%%%%%)____________
( / / )%%%%%%%( \ \ )
(/// ____)
( / /(%%%%%%%)\ \ )
(// (%%%%%%%) __) A hard-working bee.
/( )
/ (%%%%%)
(%%%)
!
== SUMMARY / STATUS
BPlot is in ALPHA status. Two dimmensional plots seem to work well but they really need more testing. Surface plots and some other features are not implemented yet.
BPlot uses Gnuplot as the plotting engine, so you need to have Gnuplot installed and in your PATH. BPlot lets you use straight Gnuplot commands, but it also borrows some useful style syntax from Matlab to make plotting even better.
To install, I think 'gem install bplot' should do it. There are no pre-requisites, as BPLot can work with either NMatrix objects or with plain ruby arrays. That said, plotting is much easier with NMatrix objects.
== 2D PLOTS
The examples below illustrate how 2D plots work and what features they have. Try out the examples to get a feel for BPlot.
require 'bplot'
x = [1,2,3,4,5] y = [1,4,9,16,25] z = [25,20,15,10,5]
b = BPlot.new
Send a raw command into Gnuplot.
b.cmd('plot sin(x) title "Plot without Ruby."')
Global settings.
b.set('xrange [0:6]') b.set('yrange [0:30]') b.set('title "Heading for the entire plot"')
Replot the most recent plot.
b.replot
Basic plots.
b.plot(x, y) b.plot(x, y, 'ps 2', 'rh') b.plot(x, y, 'ps 2', 'rh..-', 'y = x^2')
The 'with' command on the gnuplot string takes precedence.
b.plot(x, y, 'ps 2 w lp', 'rh') b.plot(x, y, 'ps 2 with steps', 'rh')
Named parameters.
b.plot(x, y, :title => 'Density', :gnuplot => 'lc 3 ps 1.5 lt 4 pt 5 w lp') b.plot(x, y, :title => 'Density', :gnuplot => 'ps 1.5', :matlab => 'rh-') b.plot(x, y, :t => 'Mass', :g => 'ps 2.5', :m => 'bh--')
Multiple data sets (need not be the same length).
b.plot(x, y, 'ps 2', 'rh-', x, z, 'ps 1.5', 'bs--') b.plot(x, y, 'ps 2', 'rh-', 'Quadratic', x, z, 'ps 1.5', 'bs--', 'Linear')
Observe that named parameters must be at the end. Hence, they only apply to the last plot.
b.plot(x, y, 'ps 2', 'rh-', 'Quadratic', x, z, 'ps 1.5', 'bs--', :t => 'Linear') # OK. b.plot(x, y, 'ps 2', 'rh-', :t => 'Quadratic', x, z, 'ps 1.5', 'bs--', 'Linear') # ERROR.
FAQs
Unknown package
We found that bplot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.