Skip to content

Is it possible to add watermark to a plot? #30

Closed

Description

@ai-fwd

Firstly, great work on this library! Love using it.

I'm trying to recreate this example: https://plot.ly/javascript/layout-template/#add-named-container-array-items

But I don't see a way to add Images to the Layout as they have done. Is there another way to get a watermark on the plot?

Thanks.

Activity

  1. kMutagene commented on Mar 31, 2020

    @kMutagene
    Collaborator

    Hi @ai-fwd,

    Happy that you like it!

    Not nearly all options of the original plotly library are wrapped in a typesafe manner. However, we are able to recreate any javascript example by using the dynamic object stlye (the type safe functions are infact just abstractions of this style), which you can create analogously to the javascript examples. While i could not get the templates to work quickly, using background images in the layout is pretty straight forward:

    
    type LayoutImage () =
        inherit DynamicObj ()
    
    let image1 = 
        let tmp = LayoutImage()
        tmp?name    <- "watermark_1"
        tmp?source  <- "https://raw.githubusercontent.com/michaelbabyn/plot_data/master/benzene.png"
        tmp?xref    <- "paper"
        tmp?yref    <- "paper"
        tmp?x       <- 0.40
        tmp?y       <- 0.9
        tmp?sizex   <- 0.7
        tmp?sizey   <- 0.7
        tmp?opacity <- 0.1
        tmp?layer   <- "below"
        tmp
    
    let layoutUsingImage =
        let layout = Layout.init()
        layout?images <- [image1]
        layout
    
    Chart.Line(x=[0; 1; 2; 3; 4; 5],y=[2; 4; 3; 0; 5; 6])
    |> Chart.withLayout layoutUsingImage
    |> Chart.Show
    

    Rendered Chart:

    image

    Regarding templates, i think it would be quite useful having those, i will look into it when i find time

  2. added this to the Backlog milestone on Jun 15, 2020
  3. added
    Area: MissingAbstraction
    on Jun 15, 2020
  4. kMutagene commented on Nov 18, 2021

    @kMutagene
    Collaborator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: MissingAbstractionType: Enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions