Git Product home page Git Product logo

nyaplot's Introduction

Nyaplot

Build Status Gem Version

alt text

Nyaplot is an interactive plots generator for Ruby users. Its goal is to make it easy to create interactive plots in Ruby and still allows fast prototyping, customizability, and the integration with other scientific gems.

Nyaplot is a compound word from 'Nya' and 'plot.' The word 'Nya' comes from an onomatopoeia of cat's meow in Japanese.

This software has been developed as a product in Google Summer of Code 2014 (GSoC2014). Visit the website or mailing list of SciRuby to see the progress of this project.

Attention: Nyaplotjs was banned by rawgit.js and nyaplot v0.1.3 was released to fix that. Please update your nyaplot and re-excute each notebooks.

Demo

Visit nyaplot-notebooks on GitHub to see more example.

Documents

Documents are here.

Extensions

Nyaplot has an extension system to make it easy to add more normal and different types of diagrams. Libraries shown below are already bundled with this gem and you can use them by adding 'require'.

Each extension consists of its back-end written in JavaScript and a small Ruby wrapper for it.

Nyaplot3D

Nyaplot3D enables us to create interactive 3D charts with Ruby. Its back-end library is Elegans, a 3D plots generator written in JavaScript.

Nyaplot3D

To learn more, see the notebook.

Bionya

Bionya is an extension library for Nyaplot that allows us to create plots for Biology. The main content of Bionya is the circular plot, that is usually used to visualize information of genes like relationship among them. This library is inspired by circos.

Bionya

See this notebook to learn more.

Mapnya

Mapnya is an extension library for map visualization.

Mapnya

See this notebook to learn more.

Installation

Install nyaplot

Add this line to your application's Gemfile:

gem 'nyaplot'

And then execute:

$ bundle

Or install it yourself as:

$ gem install nyaplot

Install IRuby notebook

Nyaplot do not have any dependency, but we strongly recommend to install IRuby by @minad at the same time. IRuby is a web-based interactive Ruby environment and Nyaplot is totally designed to work with it. You can install the gem itself by running gem install command, but it has some dependent libraries outside of Ruby-ecosystem.

Ubuntu 14.10

There are various ways to install Python and IPython notebook, but Anaconda is highly recommended.

IRuby requires IPython >= 1.1 and libzmq >= 3.2, so update IPython and install libzmq3 before installing IRuby.

conda update ipython
sudo apt-get install libzmq3-dev

And then try to run gem install iruby.

If the code above does not work, try below.

conda update zeromq
conda update pyzmq

Mac OS X

On Mac OS X the IRuby notebook installation is a little bit tricky. You would be better off using Anaconda for The IPython notebook dependencies except for zeromq. Please be sure to remove conda zeromq package, and install zeromq with homebrew.

conda remove zeromq
brew install zeromq

Windows

First, install IPython and its dependencies using Enthought Canopy. There are various ways to install IPython, but Canopy may be the most useful to Windows users.

Then install IRuby by running gem install iruby.

After that, install ZeroMQ from here. Be sure to install stable release of the version 3.2.?.
Attention: install 32bit version of Zeromq even if your Windows is built for 64-bit.

Add the path to the directory of ZeroMQ binaries (Maybe the path is Program Files (x86)/ZeroMQ 3.2.4/bin) to environment variables PATH.

Then rename libzmq-v100-mt-3_2_4.dll to libzmq.dll. It maybe in Program Files (x86)/ZeroMQ 3.2.4/bin.

At last, pure IRuby do not work on Windows, so please apply patches I sent before to IRuby.

Acknowledgments

This software has been developed by Naoki Nishida as a product in Google Summer of Code 2014 (GSoC2014). Visit the website or mailing list of SciRuby to see the progress of this project.

Contributing

  1. Fork it ( http://github.com/domitry/nyaplot/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

nyaplot's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nyaplot's Issues

Legend labels

I'm having trouble setting legend labels with either add or add_with_df. I just get 'scatter' or 'line' for each one. Is there an example somewhere?

Ability to add multiple diagrams from the same dataframe in one shot

From my knowledge of nyaplot, currently to add a new diagram (scatter, line, etc.) to the same plot from a DataFrame, user needs to use the Plot#add_with_df function every time. From the surface I think the DataFrame is being duplicated every time.

It would be great if it would be possible to configure the add_with_df method such that the diagram types and their corresponding X and Y axis columns could be specified in one shot.

Or maybe some sort of a DSL which lets you configure these options in a block, so that the corresponding Nyaplot::Diagram objects can also be configured.

Plot labels getting cut off

I'm having trouble with some longer plot labels being cut off. Below is an example. Is there some way to set margins around the plot?

fig 3

Thanks for any guidance you can provide.

Adjust label positions depending on the tick length

When using large values in one of the axis, the label is positioned in this way:

screen shot 2015-05-18 at 17 42 09

Matplotlib rewrites the ticks in scientific notation when they are very large or small (e.g. 1e7) and appears to adjust the label position when the values aren't so large. I only did some quick tests, though.

This would be really useful for quickly preparing plots. Of course I can fix them manually, but having some heuristics in place can be very useful.

just adding nyaplot gem (not even calling) gives me an error on osx (yosemite, 10.10.5)

 $ ruby lib/correlation.rb 
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/iruby-0.2.7/lib/iruby/utils.rb:8:in `display': undefined method `session' for nil:NilClass (NoMethodError)
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/nyaplot-0.1.6/lib/nyaplot/core.rb:45:in `init_iruby'
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/nyaplot-0.1.6/lib/nyaplot/core.rb:48:in `<module:Nyaplot>'
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/nyaplot-0.1.6/lib/nyaplot/core.rb:3:in `<top (required)>'
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/nyaplot-0.1.6/lib/nyaplot.rb:4:in `require_relative'
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/nyaplot-0.1.6/lib/nyaplot.rb:4:in `<top (required)>'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/daru-0.1.1/lib/daru.rb:45:in `block in create_has_library'
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/daru-0.1.1/lib/daru/plotting/vector.rb:39:in `<top (required)>'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/daru-0.1.1/lib/daru/vector.rb:5:in `<top (required)>'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/daru-0.1.1/lib/daru.rb:70:in `<top (required)>'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/statsample-2.0.1/lib/statsample.rb:25:in `<top (required)>'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
    from lib/correlation.rb:2:in `<main>'

first two lines of the file:

``ruby
require 'iruby'
require 'statsample'


if I remove the nyaplot gem everything runs fine :-(

changing datalabels on boxplots

As far as I can see the x data labels for a boxplot default to 'data0', 'data1' etc. does anyone know how to change that?

Alias 'tooltip_contents' to 'tooltips' & allow it to accept Symbol

I think that #tooltips is a more natural name than #tooltip_contents (I've had to go back to the docs 3x to remember the correct name :P). Aliasing it shouldn't be a problem, I guess.

By the way, it accepts only Arrays, right? What do you think about accepting single symbols as well? This isn't a deal-breaker, but I've done this wrong a couple of times:

# data has rows with :x, :y and :name.
plot = Nyaplot::Plot.new
scatter = plot.add_with_df(data, :scatter, :x, :y)
scatter.tooltip_contents :name # oops

As I said, this would be a nice addition, but isn't critical.

Another thing that would be nice is a boolean parameter to select if the attribute's name will be printed or not. For example, if I did the above example correctly (with scatter.tooltip_contents [:name]), the tooltips would be filled with name:etc. This kind of control is very useful.

Plot3D equivalent to add_with_df?

I was trying to do a 3D plot from a dataframe and realized the internal API is a bit different. Is Diagram3D still in the process of being updated to be similar to the API in Diagram, or will it always be different? Is it possible for me to generate a 3D plot from a dataframe?

Sorry to pester with all of the questions.

Where are your specs?

Hey Naoki,

I'm a little concerned with the lack of specs in your project. It's tough to tell how things should work when I'm making modifications without any specs — how do I know I haven't broken something?

Is this something you've simply forgotten to push?

cc @pjotrp

John

Multiple plots per frame

I searched the documentation for some example, but I couldn't find how to generate something similar to the subplots of MATLAB or Matplotlib.

Is it possible right now? If not, this would be really useful.

DataFrame#to_a giving array of nils

My object looks like this:

=> #<Nyaplot::DataFrame:0x007fb7f12ce3f8
 @name="fc7a72cc-a5d9-42f2-b138-28aa75741e6c",
 @rows=
  [{:wavelength=>0.2051, :reflectance=>-1.23e+34, :standard_deviation=>0.090781},
   {:wavelength=>0.2131, :reflectance=>-1.23e+34, :standard_deviation=>0.01882},
   {:wavelength=>0.2211, :reflectance=>-1.23e+34, :standard_deviation=>0.005416},
   {:wavelength=>0.2291, :reflectance=>-1.23e+34, :standard_deviation=>0.002928},

If I do x.wavelength, I can get that as a series:

=> #<Nyaplot::Series:0x007fb7f4854b58
 @arr=
  [0.2051,
   0.2131,
   0.2211,
   0.2291,
   0.2361,

But if I do x.each or x.to_a, I get:

=> #<Nyaplot::Series:0x007fb7f4b90380
 @arr=
  [nil,
   nil,
   nil,
   nil,

The function I use to load my data produces a hash of hashes, which is fed directly in:

def read_asc filename
  Nyaplot::DataFrame.new(CSV.open(filename, 'r', col_sep: ' ', headers: [:wavelength, :reflectance, :standard_deviation], converters: :numeric).drop(16).map do |csv_row|
    csv_row.to_h.delete_if { |k,v| k.nil? }
  end)
end

I imagine it has something to do with the use of symbols for headers, but haven't had time to test it more extensively.

labels on scatterplots?

Hi

How do I add a label to a scatter plot point? I am doing something like:

plot = Nyaplot::Plot.new
plot.width(400)
plot.height(400)
plot.zoom(true)
points_x = [10,20,30,40]
points_y = [30,20,40,80]
plot.add(:scatter, points_x, points_y)
plot.show

I'd like each point to show something on it (eg: coordinate, name, etc).

Is this possible in the current version?

Export to more formats

Nyaplot can only export to HTML currently (at least that's what I found looking at the source/rubydoc).

Being able to export to other formats, e.g. PNG (even if it would mean a static image instead of the cool dynamic plots), would be useful for reports and presentations, which are my use cases.

No comments

Hey Naoki,
I think it's good to add some comments on the codes. Specially some comments which describes what's in that particular files and classes stands for. Your variable naming is good. Comments will improve readability.

cannot find gem

Hi

I am trying to add this gem to my project via gem install nyaplot and I get:

ERROR: Could not find a valid gem 'nyaplot' (>= 0) in any repository

I'm on Mavericks (Mac OS 10.9.4) with Ruby 2.1.0

Thanks

Ability to manually set intervals of X axis.

Here's my use case:

I have a plot whose X co-ordinates exist only at integer co-ordinates (1,2,3,4,5,6), and I want to see the X axis show me only the integers at which the points exist, i.e. 1,2,3,4,5,6.

It so happens that nyaplot also displays in-between decimal numbers (0,0.5,1,1.5,2...). Having the ability to customize the step size between valid X co-ordinates would be great. OR maybe have the ability to display only the integer X co-ordinates.

Here's a picture of how the X axis looks as of now:
screenshot from 2015-06-09 22 49 28

Images never show --> TypeError: Can not read property prototype

When running the examples in iruby. Plot.show in the browser generates the following:

=====>
Javascript error adding output!
TypeError: Cannot read property 'pane' of undefined
See your browser Javascript console for more details.
Out[3]:
["display_data", "<IDS|MSG>", "2921bf49eb70d9bd96b21c38215b195320e4956f4f9497a9bde353574446c444", "{"msg_type":"display_data","msg_id":"d804d835-4cdd-4601-a427-82cfbaff7477","username":"kernel","session":"51465e7f-83a7-46d4-ab54-cf115441e807","version":"5.0"}", "{"username":"username","version":"5.0","msg_id":"8F7E63E9D1A84CEE8B01C38B8F38E97B","msg_t ...
=====>

instead of displaying the plot. I also noticed on the terminal the following messages when I start iruby notebook at the examples folder:

=====>
/usr/local/lib/ruby/gems/2.2.0/gems/nyaplot-0.1.6/examples/notebook $ iruby notebook
Could not load bundler: iruby is missing from Gemfile. This might not work.
Add gem 'iruby' to your Gemfile to fix it.
[I 14:18:02.945 NotebookApp] Serving notebooks from local directory: /usr/local/lib/ruby/gems/2.2.0/gems/nyaplot-0.1.6/examples/notebook
[I 14:18:02.945 NotebookApp] 0 active kernels
[I 14:18:02.945 NotebookApp] The IPython Notebook is running at: http://localhost:8888/
[I 14:18:02.945 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 14:18:13.391 NotebookApp] Notebook 3DPlot.ipynb is not trusted
[I 14:18:13.746 NotebookApp] Kernel started: c2a15589-00b2-45a9-a7bc-7400cbcaa81a
W, [2016-02-16T14:18:14.585399 #4832] WARN -- : Could not load bundler: iruby is missing from Gemfile. This might not work.
Add gem 'iruby' to your Gemfile to fix it.
/usr/local/lib/ruby/gems/2.2.0/gems/iruby-0.2.8/lib/iruby/command.rb:108:in check_bundler' /usr/local/lib/ruby/gems/2.2.0/gems/iruby-0.2.8/lib/iruby/command.rb:67:inrun_kernel'
/usr/local/lib/ruby/gems/2.2.0/gems/iruby-0.2.8/lib/iruby/command.rb:34:in run' /usr/local/lib/ruby/gems/2.2.0/gems/iruby-0.2.8/bin/iruby:5:in<top (required)>'
/usr/local/bin/iruby:22:in load' /usr/local/bin/iruby:22:in

'
=====>

hope this helps.

P.S. note that arrows above are added by me for clarity. Thank you.

Allow nil in data passed to graphs

Currently when I pass a nil in an Array for plotting, nyaplot returns an error.

It would be great if it could handle nils properly by not plotting the points where they appear, like GNU plot.

Here's some example code:

require 'nyaplot'

p = Nyaplot::Plot.new
p.add(:scatter, [10,nil,30], [0,1,2])
p.show
#ArgumentError: comparison of NilClass with 10 failed

Nyaplot basic example not working

Few days ago I filed this issue #65 and it turns out that not even basic examples which do not involve iRuby are working for me. I am using the latest nyaplot gem installed via gem install nyaplot.

This is the example I ran and below is my IRB output:

?> require 'nyaplot'
=> true
>> 
?> # Bar chart
?> plot = Nyaplot::Plot.new
=> #<Nyaplot::Plot:0x0000000320edf8 @properties={:diagrams=>[], :options=>{}}>
>> plot.add(:bar, ['Persian', 'Maine Coon', 'American Shorthair'], [10,20,30])
=> #<Nyaplot::Diagram:0x00000003200c08 @properties={:type=>:bar, :options=>{:x=>"data0", :y=>"data1"}, :data=>"191ab013-5f74-456e-98d0-ed422c72700c"}, @xrange=["Persian", "Maine Coon", "American Shorthair"], @yrange=[0, 30]>
>> plot.x_label("Species")
=> #<Nyaplot::Plot:0x0000000320edf8 @properties={:diagrams=>[#<Nyaplot::Diagram:0x00000003200c08 @properties={:type=>:bar, :options=>{:x=>"data0", :y=>"data1"}, :data=>"191ab013-5f74-456e-98d0-ed422c72700c"}, @xrange=["Persian", "Maine Coon", "American Shorthair"], @yrange=[0, 30]>], :options=>{:x_label=>"Species"}}>
>> plot.y_label("Number")
=> #<Nyaplot::Plot:0x0000000320edf8 @properties={:diagrams=>[#<Nyaplot::Diagram:0x00000003200c08 @properties={:type=>:bar, :options=>{:x=>"data0", :y=>"data1"}, :data=>"191ab013-5f74-456e-98d0-ed422c72700c"}, @xrange=["Persian", "Maine Coon", "American Shorthair"], @yrange=[0, 30]>], :options=>{:x_label=>"Species", :y_label=>"Number"}}>
>> plot.export_html("bar.html")
=> 2245

When I open "bar.html" in Firefox or Chromium I get blank page with "Nyaplot" as title of the page.

Here is the output to "bar.html" file.

Any suggestions?

building problem

Hi Naoki,
I tried below to install your gem.
sudo rake nyaplot.gemspec
But it isn't installing the gem. Is this an issue? Am I doing it right?

problem while running spec files

Hi,
I got an error while trying to run the spec files.
rspec data_spec.rb

This is the error I'm getting:
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- spec_helper (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from /home/lahiru/dump/nyaplot/spec/data_spec.rb:1:in <top (required)>' from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:inload'
from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:in block in load_spec_files' from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:ineach'
from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:in load_spec_files' from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:97:insetup'
from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:85:in run' from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:70:inrun'
from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:38:in invoke' from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/exe/rspec:4:in<top (required)>'
from /usr/local/bin/rspec:23:in load' from /usr/local/bin/rspec:23:in

'

Empty plots occur when adding other gems

I have a very strange issue with empty plots occuring depending on what other dependencies I load into my iRuby notebook session.

If I run this:

In [1]: require 'nyaplot'
Out[1]: true

In [2]: p = Nyaplot::Plot.new
        p.add(:bar, ['a','b','c'], [1,2,3])
        p.show

It works great:
image

However, if i then require 'mongoid', and try to run that line again, I get an empty plot:
image

Any help is appreciated! Thanks!

Better tooltip positioning for boxplots

I'm doing some boxplots and noticed that the tooltips with mean, max, etc values can hide one another. For example:

Boxplot with hidden labels

Maybe positioning these labels relative to each other instead of based on the values of the distribution could solve this problem. What do you think?

Use daru as default DataFrame library

While making some tutorials for using daru as a visualization tool with nyaplot for my GSOC project, I came across quite a few instances where I realized that instead of first converting to nyaplot data types, it would be very convenient if users could simply use daru with nyaplot directly.

For example, scatter plots automatically update themselves when the corresponding data frame is updated, but this can only be done when it's a Nyaplot::DataFrame (or now a Mikon::DataFrame).

I think it will be in the best interests of both daru and nyaplot if we used daru with nyaplot.

Here are more reasons for my conviction:

  • Daru will be the primary data library for all the statsample gems (time-series, glm, etc.). Making it simple to pass data between a stats library and nyaplot would make life much much easier for users of both our libraries. Currently I'm almost done with statsample integration and have also written detailed tutorials on using daru (more coming soon).
  • Daru will soon support time series, plotting this data properly is very important and nyaplot has the right capabilities for the same.
  • Daru supports single and hierarchical indexing and many table operations like join, merge, etc. Also pivot table and sorting when preserving indexing.
  • Daru is quite capable of handling 'wild' data. It sports support for statistical analysis with missing data present and has a bunch of methods to deal with missing data. This will only get better with time.
  • Burden on time and space will be greatly reduced if inter-conversion between daru and nyaplot data is avoided.
  • Daru integrates very well with IRuby notebook.
  • There will be a clear focus for Ruby scientific libraries (DataFrame and interactive plotting in this case).

DataFrame columns

Hey Naoki,

Is there some reason you choose to store the data frame column names as strings instead of symbols? Symbols would be more efficient.

FYI, I'm going to contribute some DataFrame code in a bit, but wondered about this.

John

Avoid label mangling in axes

I create a plot (the one below) and the label names in the X axis aren't distinct. If they could be displayed partially or without overlapping, that would be great.

plot_top_ten

better add more spec files

Hey Naoki,
I checked your specs and I saw there were specs only for 2 classes. It's easy to run and test your code if you add more specs. Again you may add some comments also in specs (maybe after the deadline). It's hard to understand the content of your test files.

Name 'Nyaplot' should be 'nyaplot'

I just cloned this to check out your great work! I noted when trying to cd into the Nyaplot clone I made that it's actual name not following the familiar convention by starting with a capital letter. i.e

$ ls 
Nyaplot/                         method_source-0.8.2/             rdoc-4.1.1/
backports-3.6.0/                 multi_json-1.10.1/               rspec-3.0.0/
codeclimate-test-reporter-0.3.0/ multi_test-0.1.1/                rspec-core-3.0.2/
coderay-1.1.0/                   narray-0.6.0.9/                  rspec-expectations-3.0.2/
colorize-0.7.3/                  nmatrix/                         rspec-longrun-1.0.1/
cucumber-1.3.15/                 nmatrix-0.1.0.rc3/               rspec-mocks-3.0.2/
diff-lcs-1.2.5/                  packable-1.3.6/                  rspec-support-3.0.2/
docile-1.1.5/                    pry-0.10.0/                      sciruby.com/
ffi-1.9.3/                       rake-10.3.2/                     simplecov-0.8.2/
fftw/                            rake-compiler-0.8.3/             simplecov-html-0.8.0/
fftw-0.0.4.rc1/                  rake-compiler-0.9.2/             slop-3.5.0/
fftw3-0.3/                       rake_tasks-2.0.6/
gherkin-2.12.2/                  rb-gsl/

It's probably going to be easier for people to find your gem if you change the name to nyaplot

tooltips for heatmaps

I've searched the docs and the examples but I can't find a way to implement tooltips for heatmaps.
Most simply, I'd just like to see the numeric value associated with the box.
Thanks

Kernel.instance is nil in utils.rb

Hi,

I am currently trying to use the nyaplot plot generator for a project that I am working on. I able to successfully instantiate a plot object. I'm also able to successfully call the 'add' method to add a type (:bar), and the x and y array data, however, when I call 'show' I get a NoMethodError: undefined method `session' for nil:NilClass.

I am getting the error because Kernal.instance is nil when 'session' is called via the display method in the utils module.

Now, I am new to plotting using nyaplot so I assumed at first I could be doing something wrong, but I was able to recreate the issue outside my project using the steps shown below. Any help in either getting the issue resolved, suggesting a work around or in pointing me to what I could be doing wrong would be greatly appreciated.

Recreation...

$ irb
2.1.1 :001 > require 'nyaplot'
=> true
2.1.1 :002 > require 'iruby'
=> true
2.1.1 :003 > plot = Nyaplot::Plot.new
=> #<Nyaplot::Plot:0x00000101209c78 @properties={:diagrams=>[], :options=>{}}>
2.1.1 :004 > bar = plot.add(:bar, ['Test1', 'Test2', 'Test3'], [10,20,30])
=> #<Nyaplot::Diagram:0x0000010114a490 @properties={:type=>:bar, :options=>{:x=>"data0", :y=>"data1"}, :data=>"3dff1878-d3f2-4e2e-b132-51fb77c2cb1d"}, @xrange=["Test1", "Test2", "Test3"], @yrange=[0, 30]>
2.1.1 :005 > plot.show
NoMethodError: undefined method `session' for nil:NilClass

Another recreation…

$ irb
2.1.1 :001 > require 'iruby'
=> true
2.1.1 :002 > require 'nyaplot'
NoMethodError: undefined method `session' for nil:NilClass

Show Y axis values in line graphs

Line graphs only show the line along which the data exists and are very limiting in nature for things like showing the temperature of a city on each day of the week.

It would be great if line graphs could display the Y co-ordinate values at the vertices. Adding tooltip_contents support like that in scatter plots would also be good.

Heres an example graph of what I'm saying:

legend_options do not appear to work

array_of_values = [5..10]
plot1 = Nyaplot::Plot.new
b_plots = {}
array_of_values.each_with_index do |values, index|
  b = [0..5].map{|i| i*value}
  b_plots[values] = plot1.add(:line, truncate, b)
  b_plots[values].title("V = #{values}")
end

plot1.x_label("Test #")
plot1.y_label("number of occurrences")
plot1.legend(true)
plot1.bg_color("#FFF")
plot1.legend_options({title: 'test title', font_size: 34.0 })
plot1.export_html('info.html')

legend_options appears to be set correctly but it does not change what is displayed. No title or change in font size.

Box plots: nominal data only?

It seems like box plots only work with nominal data, but I'd like to make a candlestick plot where the independent variable is numeric and not distributed at a regular interval. Is there a way to accomplish this?

Allow LaTeX in labels

This is a very important feature for using Nyaplot in more contexts. Better labels also make graphs more readable.

This should be possible with MathJax, I think.

ActiveRecord-like syntax for DataFrame

It'd be super cool if we could use the SQL-like features of ActiveRecord with DataFrame. I haven't given much thought to how this would look, except perhaps df.where(:my_column => 3). I think this could help us to generate some summary-type dataframes quickly. Let's say, for example, that you want the mean of some column, but only where another column is between 0 and 3.

Renaming projects

When you rename a project on github you lose all existing issues!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.