New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bplot

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bplot

  • 0.0.2.4
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= 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

Package last updated on 25 Aug 2012

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc