WIP: bitmap nodes
Answering #74
usage example:
logo_urls = [
"https://github.com/JuliaFEM/JuliaFEM.jl/raw/master/docs/logo/JuliaFEMLogo_96x96.png",
"https://user-images.githubusercontent.com/25916/36773410-843e61b0-1c7f-11e8-818b-3edb08da8f41.png",
"http://docs.juliadiffeq.org/v2.0.0/assets/logo.png",
"https://raw.githubusercontent.com/JuliaLang/IJulia.jl/master/deps/ijulialogo.png"
]
fnames = []
for logo in logo_urls
fname = tempname()
push!(fnames,fname)
download(logo,fname)
end
logos = read.(fnames)
g = SimpleGraph(ones(Int,length(fnames),length(fnames)))
simg = gplot(g, node_bitmap=logos)

The current problem is the horizontal light gray line under the logos especially if the logo is transparent like highest one at the above picture.
Another usage example:
logo_name = tempname() * ".png"
# CC BY-SA 3.0 https://commons.wikimedia.org/wiki/File:Personal_Computer_Icon.png
download("https://upload.wikimedia.org/wikipedia/commons/0/06/Personal_Computer_Icon.png",logo_name)
computer_logo = read(logo_name)
g = SimpleGraph(ones(Int,20,20))
gplot(g, node_bitmap=[computer_logo for i in 1:nv(g)])

Third example:
# License: Freeware http://www.iconarchive.com/show/karate-icons-by-findhold/karate-flyingkick-icon.html
# License: Freeware http://www.iconarchive.com/show/karate-icons-by-findhold/karate-block-icon.html
karateka = tempname() * ".png"
karateka2 = tempname() * ".png"
download("http://icons.iconarchive.com/icons/findhold/karate/128/karate-flyingkick-icon.png",karateka)
download("http://icons.iconarchive.com/icons/findhold/karate/128/karate-block-icon.png", karateka2)
karateka_pngs = read.([karateka,karateka2])
g = graphfamous("karate")
membership = [1,1,1,1,1,1,1,1,2,1,1,1,1,1,2,2,1,1,2,1,2,1,2,2,2,2,2,2,2,2,2,2,2,2]
pictures = karateka_pngs[membership]
gplot(g, node_bitmap=pictures)

Codecov Report
Merging #75 into master will decrease coverage by
31.74%. The diff coverage is28.57%.
@@ Coverage Diff @@
## master #75 +/- ##
===========================================
- Coverage 48.21% 16.46% -31.75%
===========================================
Files 3 8 +5
Lines 168 498 +330
===========================================
+ Hits 81 82 +1
- Misses 87 416 +329
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/layout.jl | 22.07% <0%> (-77.93%) |
:arrow_down: |
| src/plot.jl | 34.06% <33.33%> (-39.11%) |
:arrow_down: |
| src/lines.jl | 22.07% <0%> (-8.84%) |
:arrow_down: |
| src/pienode.jl | 0% <0%> (ø) |
|
| src/collapse_plot.jl | 0% <0%> (ø) |
|
| src/deprecations.jl | 0% <0%> (ø) |
|
| src/shape.jl | 0% <0%> (ø) |
|
| src/stress.jl | 0% <0%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update adeda23...9130d0d. Read the comment docs.
That's an interesting addition. Is there a way, that also compose contexts could be used instead of bitmap? (not sure if we would need that though).
I think the problem with the gray line under the transarent logos is, that we currently don't handle self loops correctly.
I am not expert on Compose.jl. I wanted to have a plot with logos and made quick and dirty solution. I am willing to finalize it, if you think it's a good addition. Some tests should be added but I don't have an idea how to test it.
Now spending Christmas with my family and left my computer home.
bump @TeroFrondelius, now that two Christmas have passed
If someone wants to finalize this please feel welcome. I don't remember the details anymore and it seems that I won't find time to work on this.
I know it's an old thread, but just wanted to say this feature would be incredibly useful! Busy at the moment, and don't have much programming skills, but maybe in the future I could help look at it. But maybe someone else too!