Code Monkey home page Code Monkey logo

ocaml-matplotlib's Introduction

ocaml-matplotlib

Plotting for ocaml using matplotlib pyplot and object-orient apis.

Use in Jupyter notebooks

To use in an ocaml jupyter notebook, you can add the following in you jupyter init script, or in a notebook cell.

open Matplotlib;;
let plot () =
  let data = Mpl.plot_data `png in
  ignore (Jupyter_notebook.display ~base64:true "image/png" data);;

let () =
    Mpl.set_backend Agg;
    Mpl.style_use "ggplot"
;;

Using plot in the notebook then flushes the current picture and displays it (no need for a temporary file, everything is in memory).

ocaml-matplotlib'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

Watchers

 avatar  avatar  avatar  avatar

ocaml-matplotlib's Issues

how can i build this (trying to contribute)

I'd like to modify the code in the .opam lib folder and then rebuild and test to eventually contribute here.

in ~/.opam/4.13.1/lib/matplotlib
running "opam ins ." on unchanged code downloaded from opam gives the error quoted below.

I'm not sure if I have totally the wrong approach to building this (I don't know how to use dune...), or if there's some other problem. Is there a simple way to build the package and install it?

Thanks!


monster@Clementine ~/.opam/4.13.1/lib/matplotlib $ opam ins .
matplotlib is now pinned to file:///home/monster/.opam/4.13.1/lib/matplotlib (version dev)
The following actions will be performed:
  ↗ upgrade matplotlib 0.2 to dev*

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[matplotlib.dev] synchronised from file:///home/monster/.opam/4.13.1/lib/matplotlib

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of matplotlib failed at
        "/home/monster/.opam/opam-init/hooks/sandbox.sh build dune build -p
        matplotlib -j 3 @install".

#=== ERROR while compiling matplotlib.dev =====================================#
# context     2.0.7 | linux/x86_64 | ocaml-base-compiler.4.13.1 | pinned(file:///home/monster/.opam/4.13.1/lib/matplotlib)
# path        ~/.opam/4.13.1/.opam-switch/build/matplotlib.dev
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p matplotlib -j 3 @install
# exit-code   1
# env-file    ~/.opam/log/matplotlib-51452-05296d.env
# output-file ~/.opam/log/matplotlib-51452-05296d.out
### output ###
# Error: I don't know about package matplotlib (passed through --only-packages)



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build matplotlib dev
└─ 
╶─ No changes have been performed



Showing a plot without blocking the process?

After Matplotlib.Mpl.show(), the program is blocked from interaction until the matplotlib window is closed. Is there a way to generate (multiple) plot windows and keep them open while continuing interaction with the ocaml process (not interaction with the plot itself)?

opam release?

Hi, I'm not sure how this works, but the version I have through opam isn't the most up to date -- in particular I'm looking for the legend functionality, which I see you've added after your initial publication to opam. Would it be possible to push the latest over to opam?

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.