Comments (10)
Hmm, that's not a bad idea, though copying to the clipboard in a cross-platform way may be a pain.
How best to include plots in documents is something I need to document more thoroughly though.
This may or may not be helpful, but here is a document generation system in Gadfly that is designed to produce documents with a lot of code examples and plots. It works by writing normal markdown:
If you make a file like this.
# An example
This is an example of executable markdown.
```julia
using Gadfly
draw(SVG(4inch, 4inch), plot(sin, 0, 20))
```
There is a script that comes with gadfly that will turn this into an html file with all the plots rendered and the julia code syntax highlighted. If you pass it the --self-contained
flag, all the the images will be embedded directly in the document using data URIs.
So if you run:
~/.julia/bin/gadfly document.md > document.html
You'll get totally self contained html file with embedded images. This relies on having pandoc installed, though.
from gadfly.jl.
I get this error:
ERROR: no method *(Cmd,Cmd)
in execblock_julia at /home/dzea/.julia/Gadfly/src/weave.jl:320
in weave at /home/dzea/.julia/Gadfly/src/weave.jl:116
in include_from_node1 at loading.jl:76
in process_options at client.jl:255
in _start at client.jl:318
at /home/dzea/.julia/Gadfly/bin/gadfly:75
from gadfly.jl.
[ Maybe if copy to clipboard is difficult, and I think can be... Using embed()
for open the code on the navigator instead of the plot for a easy copy&paste can be an option ? ]
from gadfly.jl.
Actually that's pretty easy to do. Instead of pointing the browser to the plot, it can use a view-source URI, and point it to view-source:file://some/temporary/file.html
which would show the code for the plot that you can then copy and paste. I could add a viewsource
function that does that.
But I'm really hesitant to try to do anything with the clipboard directly, it's hard to get right, much less right on multiple platforms.
from gadfly.jl.
Yes, but I believe that the code source is not exactly the same that is needed for copy&paste between a blog text. I don't have experience with that, so I can be wrong.
from gadfly.jl.
For example, I copy&paste the <div>
of the <body>
of the plot into the HTML of my blog post, but I see this:
http://experienciasconjulia.wordpress.com/2013/02/22/10/
from gadfly.jl.
But... Looks to be a problem between WordPress and the HTM, the same code on Blogger works fine:
http://fisica1unq.blogspot.com.ar/2013/02/example-0.html
What I says about the embed()
o source()
functions is generate the code without the header. Just ready for copy&paste inside a post or page.
from gadfly.jl.
Oh, that's interesting.
I found a wordpress bug report about inline svg. It seems they don't support it. So for wordpress, you'll have to save the plot to a file and include it using an <object>
tag.
from gadfly.jl.
Thanks, I think I going to use blogger if I can SyntaxHighligter works on it.
Another similar stuff happens with view
on Gmail if you attach the .html output file.
People who receives the mails and click view only see code instead of the plot.
from gadfly.jl.
I don't think the gmail issue is solvable. It looks like gmail doesn't support sending html email. Even if you send an html document as an attachment, it strips out anything it deems "unsafe", which is any javascript or anything embedded with the <object>
tag.
The best option now is to put the plot somewhere and send a link. Once I fix the cairo backend, you'll also be able to send a PDF/PS/PNG file, which gmail might be less suspicious of.
from gadfly.jl.
Related Issues (20)
- Gadfly not working for simple point plot HOT 2
- tests and building docs currently failing HOT 3
- typos HOT 3
- Question re wrapping Gadfly.jl functionality in Tidier.jl HOT 8
- Wrong x-axis upper limit with date ? HOT 6
- Please add a feature to vary the thickness of the line in Geom.line and Geom.path HOT 1
- Specifying number of ticks HOT 6
- trying to use `Stat.yticks` causes `MethodError`
- Gadfly histogram ignore the bincount (and how to remove background lines) HOT 2
- Gadfly pop up not working in Ubuntu - workaround HOT 1
- How to set the width of the bar? HOT 1
- How to supress output to stdout? HOT 8
- Zooming broken on faceted plots
- Hexbin plotting out of range
- tspan in svg output is malformated HOT 5
- colorkey min/max values HOT 1
- Can't add title to 2D function plot HOT 1
- Gadfly v1.4.0 ?
- SVG does not work with Gadfly 1.4.0 and Compose 0.9.5 HOT 6
- SVG generation has a XML mistake on tag <tspan>
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gadfly.jl.