{"action":"created","issue":{"url":"https://api.github.com/repos/ruby-numo/gnuplot/issues/11","repository_url":"https://api.github.com/repos/ruby-numo/gnuplot","labels_url":"https://api.github.com/repos/ruby-numo/gnuplot/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/ruby-numo/gnuplot/issues/11/comments","events_url":"https://api.github.com/repos/ruby-numo/gnuplot/issues/11/events","html_url":"https://github.com/ruby-numo/gnuplot/pull/11","id":204746319,"number":11,"title":"allows to \"End of animation sequence\" message","user":{"login":"icm7216","id":16305594,"avatar_url":"https://avatars.githubusercontent.com/u/16305594?v=3","gravatar_id":"","url":"https://api.github.com/users/icm7216","html_url":"https://github.com/icm7216","followers_url":"https://api.github.com/users/icm7216/followers","following_url":"https://api.github.com/users/icm7216/following{/other_user}","gists_url":"https://api.github.com/users/icm7216/gists{/gist_id}","starred_url":"https://api.github.com/users/icm7216/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icm7216/subscriptions","organizations_url":"https://api.github.com/users/icm7216/orgs","repos_url":"https://api.github.com/users/icm7216/repos","events_url":"https://api.github.com/users/icm7216/events{/privacy}","received_events_url":"https://api.github.com/users/icm7216/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-02-02T00:17:55Z","updated_at":"2017-02-02T00:25:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ruby-numo/gnuplot/pulls/11","html_url":"https://github.com/ruby-numo/gnuplot/pull/11","diff_url":"https://github.com/ruby-numo/gnuplot/pull/11.diff","patch_url":"https://github.com/ruby-numo/gnuplot/pull/11.patch"},"body":"This patch comes to be able to continue in the \"End of animation sequence\" message  when creating animation gif."},"comment":{"url":"https://api.github.com/repos/ruby-numo/gnuplot/issues/comments/276827879","html_url":"https://github.com/ruby-numo/gnuplot/pull/11#issuecomment-276827879","issue_url":"https://api.github.com/repos/ruby-numo/gnuplot/issues/11","id":276827879,"user":{"login":"icm7216","id":16305594,"avatar_url":"https://avatars.githubusercontent.com/u/16305594?v=3","gravatar_id":"","url":"https://api.github.com/users/icm7216","html_url":"https://github.com/icm7216","followers_url":"https://api.github.com/users/icm7216/followers","following_url":"https://api.github.com/users/icm7216/following{/other_user}","gists_url":"https://api.github.com/users/icm7216/gists{/gist_id}","starred_url":"https://api.github.com/users/icm7216/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icm7216/subscriptions","organizations_url":"https://api.github.com/users/icm7216/orgs","repos_url":"https://api.github.com/users/icm7216/repos","events_url":"https://api.github.com/users/icm7216/events{/privacy}","received_events_url":"https://api.github.com/users/icm7216/received_events","type":"User","site_admin":false},"created_at":"2017-02-02T00:25:16Z","updated_at":"2017-02-02T00:25:16Z","body":"これで jupyter notebook で lifegame が動くようになりました。\r\n\r\n``` ruby\r\nrequire 'numo/narray'\r\nrequire 'numo/gnuplot'\r\nrequire \"base64\"\r\n\r\nclass LifeGame\r\n\r\n  def initialize(nx,ny,m)\r\n    @data = Numo::UInt8.zeros(ny,nx)\r\n    @data[m..ny-1-m,m..nx-1-m] = Numo::UInt8.new(ny-2*m,nx-2*m).rand(2)\r\n    @step = 0\r\n  end\r\n\r\n  def update\r\n    b = Numo::UInt8.zeros(*@data.shape)\r\n    b[1..-2,1..-2] =\r\n      @data[0..-3,0..-3] + @data[0..-3,1..-2] + @data[0..-3,2..-1] +\r\n      @data[1..-2,0..-3] + @data[1..-2,2..-1] +\r\n      @data[2..-1,0..-3] + @data[2..-1,1..-2] + @data[2..-1,2..-1]\r\n    @data.store((b.eq 3) | ((b.eq 2) & Numo::Bit.cast(@data)))\r\n    @step += 1\r\n  end\r\n\r\n  attr_reader :data,:step\r\nend\r\n\r\nnx,ny = 90, 60\r\nlife = LifeGame.new(nx,ny,1)\r\nfilename = \"lifegame.gif\" \r\n\r\nNumo.gnuplot do\r\n  reset\r\n  set output: filename\r\n  set term: \"gif\", animate:true, delay:10, size:[600,400]\r\n  set :nokey\r\n  set size: {ratio:1.0*ny/nx}\r\n  set xrange: -1..nx\r\n  set yrange: -1..ny\r\n  unset :colorbox\r\n  set palette_defined:'(0 \"white\", 1 \"green\")'\r\n\r\n  101.times do |i|\r\n    life.update if i > 0\r\n    set title:\"lifegame step=#{i}\"\r\n    plot life.data, :flipy, with:\"image\"\r\n  end\r\n  set :output\r\nend\r\n\r\nimg = Base64.strict_encode64(File.binread(filename))\r\nIRuby.html %Q(<img src=\"data:image/gif;base64,#{img}\" />)\r\n```\r\n\r\n![lifegame](https://cloud.githubusercontent.com/assets/16305594/22532246/6453af66-e929-11e6-8195-758c56b318c9.gif)\r\n"}}
{"actor":{"display_login":"icm7216"}}