Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding logo #186

Closed
akubisch opened this issue Apr 7, 2018 · 2 comments
Closed

Adding logo #186

akubisch opened this issue Apr 7, 2018 · 2 comments

Comments

@akubisch
Copy link

akubisch commented Apr 7, 2018

Hi @sglyon,
It's me again :-) Next thing I would need to get to work is adding a logo to a plot. After researching a bit, this is the approach I tried:

myStyle = let
    logoImg = attr(source = "https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/Julia_prog_language.svg/200px-Julia_prog_language.svg.png",
                  sizex = 0.2,
                  sizey = 0.2,
                  x = 0.5,
                  y = 0.5,
                  sizing = "stretch",
                  layer = "above",
                  visible = "true"
                  )
    layout = Layout(images = logoImg)

    Style(layout=layout)
end

trace1 = scatter(;x=1:4, y=[10, 15, 13, 17], mode="lines")
plot([trace1], style = myStyle)

When I execute that I just do not see the logo anywhere... Am I missing something obvious?
I also tried base64-encoding a local png file to create a png URI (which would be my favourite solution), but getting online graphs to work would of course be the first necessary step.

@sglyon
Copy link
Member

sglyon commented Apr 7, 2018

For a layout, the images may need to be an array...

Have you tried putting it in [] ?

@akubisch
Copy link
Author

akubisch commented Apr 7, 2018

That was too easy ;-) The following code works:

myStyle = let
    logoImg = attr(source = "https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/Julia_prog_language.svg/200px-Julia_prog_language.svg.png",
                  sizex = 0.2,
                  sizey = 0.2,
                  x = 0.5,
                  y = 0.5,
                  sizing = "stretch",
                  layer = "above",
                  visible = "true"
                  )
    layout = Layout(images = [logoImg])
    Style(layout=layout)
end

trace1 = scatter(;x=1:4, y=[10, 15, 13, 17], mode="lines")
plot([trace1], style = myStyle)

@akubisch akubisch closed this as completed Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants