[IPython-dev] IPython Notebook Diagrams

Tavish Armstrong tavisharmstrong at gmail.com
Wed Feb 19 18:44:45 EST 2014


On Wed, Feb 19, 2014 at 03:37:24PM -0800, Andrew Gibiansky wrote:
> Hello,
> 
> I am tired of needing to create diagrams externally and then either
> use Markdown links (which require the image to be exported and saved
> somewhere) or copy/pasting the base64 encoding of the image into the
> Markdown cell (which occasionally crashes my browser for big images).
> I would like to be able to create diagrams immediately within the
> Markdown cells.
> 
> What's the best way to do this? I wanted to go with RaphaelJS and put
> <script> tags within Markdown cells, but it seems that that is broken
> on master due to bad parsing of quotes (though I've heard discussion
> that it'll be completely removed in 1.0, which leaves me confused,
> since it's clearly not completely removed...)
> 
> How would you suggest going about this goal?

For very simple diagrams, you might want to take a look at %blockdiag
magic:

https://bitbucket.org/vladf/ipython-diags

It takes a cell containing...

    %%blockdiag
    {
    a -> b -> c -> d;
    c -> e;
    e -> a;
    }

and generates a block/sequence/activity diagram using that spec.

Hope this helps,
-- 
Tavish



More information about the IPython-dev mailing list