datavis 2016-01-25

@stathissideris: do you support embedding images in SVG with dali?

@kephale other SVGs or bitmaps?

bitmaps is more this question, sometimes i can get them to other vector graphics formats though

so you can embed them like you would do with normal SVG syntax (dali is just a layer over normal SVG anyway). There are currently no functions that make it more convenient, but I'd like to add some functionality for that

If you'd like to give me some use cases I'd be happy to take them into account

also, the 0.7.0-SNAPSHOT is release quality if you'd like to give it a go

the most minimal use case that would probably keep me happy for a long time would just be tiling images side-by-side with graphs

the reason I haven't announced yet is because of lack of documentation

cool, i’ve been pretty happy so far, but being able to toss raster/bitmap images in would make it easier to go all-in

still doing a bit of that in manual programs like Illustrator

you mean you've used it already?

enough to know that it covers almost all the bases for me

but still not for my final figures

oh wow, hadn't realised I had users, that's good to know!

yeah, tell me a bit more about what you'd like to do and I'll add some stuff post-0.7 (I'd like to get the release out of the way before I add more features)

with rasters then i can start trying to convince people that i’ve made the plots in illustrator

@kephale: also, if you'd like to contribute any examples, that would be most welcome

i mean literally just being able to toss in bitmaps in, i have things like N images that biologists have taken, pull out a good example, and need to side by side that with a graph that describes all N images based on some measured features

right now there are still some manual steps at the end, where i’m tossing the raster image next to the vector-based graph in something like powerpoint or illustrator

but one can imagine how that slows down the iteration cycle

I'll experiment a bit with the image tag then simple_smile

I was thinking that embedding other SVGs may be higher priority

but you have a real use case

yeah, i mean embedding other SVGs is certainly useful, but just supporting bitmaps would go a long way since worst case folks with existing SVGs cooould rasterize them if need be

certainly all the downsides of rasterizing come with that

so it temporarily covers some SVG import cases

albeit not pleasantly : P

so you'd lay them out using [:matrix] or something?

for the tiling case, in the longer run i can definitely foresee some use cases where one has something like 1 big graph, then wants to put example images next to things like peaks in the graph (this bump corresponds to the healthy samples, and this other one one corresponds to the pathological cases)

that would have to be manual

I mean you'd have to mess around with coords

dali can only help you this grid-like layouts mainly

Yeah, manual is fine/expected for that

quick grid tilings solves a lot of things anyway

get the latest snapshot to get this functionality

haven't tried with JPEGs, let me know if you do

just PNGs for now

fair enough about pngs

is it dynamically loaded or somehow stashed in the svg?

embedded

just realized something

would you be opposed to leaving a function that could take the raw bytes + width + height as args?

the snapshot wont work, but I can fix it quickly

gimme a second

i frequently have the image in memory loaded from any one of many biological image formats

ah bytes, didn't think about that

what format is your image?

the in memory one

i can toss it into any byte format, but presumably RGB or RGBA would be the way to go

as for the file format, it really might be any one of dozens

but i have functions for converting to RGB/RGBA no problem

in order to embed it, you have to turn it into a byte array tha corresponds to PNG or something

oh, or bufferedimage

even if it's in memory

i can get to those really easily

yeah, i believe a RGBA byte array would be the same as a png

basically the same thing that imageio/read produces

i mean filename is fine anyway, since it can always be written to disk anyway, but just noting that an in-memory handoff could be useful sometimes

either way i’m excited : )

Y’all, FYI, just started a new job today, gotta turn notifications off for #datavis — if anyone needs cljs-mathbox help or whatever, just ping me! Gotta drop out of general chatter for a while though...

@kephale: trying to think of good names for the different functions...

yeah good luck simple_smile

Thanks simple_smile

Probably silly to mention it, but since the channel’s been so tight-knit…I’m super glad this channel has taken off btw!

or if you went for just supporting BufferedImages raster-bufferedimage-attr, something like that?

I think most folks with in memory images in java are likely to have helpers to get to BufferedImage

so I'll do support for BufferedImage later (but it is useful, you're right)

for now you should be able to say:

[:image {:width w :height h :xlink:href (io/data-uri bytes)}]

where io is

but a version for bufferedImage would be more like the file version

in that it would give you a map with width and height as well

but let's start with that if you think it's enough

@kephale: So I've changed the API a bit and it now would be [:image {:width w :height h :xlink:href (io/data-uri bytes "image/png")}]

you have to give it a mime type

and the file based version is slightly different, see the URL from before

I've pushed a new snapshot

so in your case you'd have an image already, without the need to load it as in the example

that should work

and I just pushed yet another snapshot

ok off to bed, let me know how it goes!

thanks @stathissideris i’ll have to delay on giving it a whirl for a couple of days, must get back to class prep, but this will be great for making figures!

yeah no rush, it'll be great to see what you make with it simple_smile