Search code examples
javascriptgraphtitleplotly.js

How to add title to each subplot in PLOTLY JS


just like in subject. I read documentation from plotly but i did not found any helpfull information. Maybe someone know how to add title to each plot in PLOTLY JS ?


Solution

  • At the moment you can,t set the subplot title directly. But you can set subplot title using annotation text.

    Hear is a example

        //Set annotations text in layout configuration
    annotations: [{
            text: "First subplot",
              font: {
              size: 16,
               color: 'green',
            },
            showarrow: false,
            align: 'center',
            x: 0.13, //position in x domain
            y: 1, //position in y domain
            xref: 'paper',
            yref: 'paper',
          },
            {
              text: "Second subplot",
              font: {
              size: 16,
              color: 'orange',
            },
            showarrow: false,
            align: 'center',
            x: 0.9, //position in x domain
            y: 1,  // position in y domain
            xref: 'paper',
            yref: 'paper',
            }
          ]
    

    Annotation text plotly.js