jsxgraph-magic
jsxgraph-magic is an IPython magic wrapper for the famous JavaScript math-sketching package JSXGraph. jsxgraph-magic enables you to use JSXGraph in Notebook and see the sketching in the output cell.
Requirements
- A network connection is required to fetch the JavaScript and CSS file for JSXGraph.
- IPython is required since the magic is the concept of the IPython.
- IPython alone cannot be much useful. Please try Jupyter Lab or Jupyter Notebook to edit with the Notebook.
Installation
-
From PIP:
pip install jsxgraph-magic
-
Development install:
git clone https://github.com/chunxy/jsxgraph-magic.git cd jsxgraph-magic pip install -e ./
Usage
-
As with usual IPython magic, remember to
%load_ext jsxgraph-magicbefore using this magic. -
This repo contains the cell magic named as jsxgraph. The magic should be used as:
%%jsxgraph [-w WIDTH] [-h HEIGHT] id <JSXGraph descriptions>where id is the
idof the HTML element to embed the JSXGraph board, width and height is the width and height of the board inpxrespectively, <JSXGraph descriptions> is the usual JavaScript code to describe the graph using the JSXGraph library.You may also run the following magic to see the description:
%%jsxgraph?
A simple example of Five-circle Theorem (code from JSXGrpah website) will be
%%load_ext jsxgraph-magic
%%jsxgraph jxgbox -w 400 -h 400
var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-5,5,5,-5]});
var p = [], l = [], i = [], c = [], j = [], k;
p[0] = brd.create('point',[-2.5,-3],{name:'',strokeColor:'#7355ff',fillColor:'#7355ff'});
p[1] = brd.create('point',[-0,4],{name:'',strokeColor:'#7355ff',fillColor:'#7355ff'});
p[2] = brd.create('point',[2.5,-3],{name:'',strokeColor:'#7355ff',fillColor:'#7355ff'});
p[3] = brd.create('point',[-4,0],{name:'',strokeColor:'#7355ff',fillColor:'#7355ff'});
p[4] = brd.create('point',[4,0],{name:'',strokeColor:'#7355ff',fillColor:'#7355ff'});
for (k=0;k<5;k++) {
l[k] = brd.create('segment',[p[k],p[(k+1)%5]],{strokeColor:'black',strokeWidth:1});
}
for (k=0;k<5;k++) {
i[k] = brd.create('intersection',[l[k],l[(k+2)%5],0],{name:'',strokeColor:'#EAEA00',fillColor:'#EAEA00'});
}
for (k=0;k<5;k++) {
c[k] = brd.create('circumcircle',[p[k],i[k],i[(k+2)%5]],{strokeColor:'gray', strokeWidth:1, point: {visible: false}});
}
for (k=0;k<5;k++) {
j[k] = brd.create('intersection',[c[k],c[(k+2)%5],0],{name:'',strokeColor:'#EA0000',fillColor:'#EA0000'});
}
cc = brd.create('circumcircle',[j[0],j[2],j[3]],{strokeColor:'red',strokeWidth:2,point:{strokeColor:'#000000',fillColor:'#000000',size:1}});
brd.update();
Metadata
Release files for jsxgraph-magic 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jsxgraph-magic-0.0.2.tar.gz | 3.3 kB | Without provenance | Details for jsxgraph-magic-0.0.2.tar.gz |
Release files / jsxgraph-magic-0.0.2.tar.gz
| Download URL | jsxgraph-magic-0.0.2.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d5d7ff9a36b6807f4fc6e3110f4643add8334903cfc460dde816a67383c3be7
|
|
BLAKE2b-256 checksum How to use checksums |
5dee64dd9e7dafc53a26d07e8f6c5e78f582bc5291715533b03c9de223758fcd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.2
|
Security for jsxgraph-magic 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.