Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Image markers on specific dates

I need to show image markers on specific dates.
With xref set to “x”, the images are not showing for date coordinates like “1991-01-15”.
The images are showing if x axis is not dates.

Plotly.plot('graph', [{
  x: ['1991-01-01', '1991-02-01', '1991-03-01'],
  y: [1, 2, 3]
}], {
  images: [
  {
    "source": "https://images.plot.ly/language-icons/api-home/python-logo.png",
    "xref": "paper",
    "yref": "paper",
    "x": 0,
    "y": 1,
    "sizex": 0.2,
    "sizey": 0.2,
    "xanchor": "right",
    "yanchor": "bottom"
  },
  {
    "source": "https://images.plot.ly/language-icons/api-home/js-logo.png",
    "xref": "x",
    "yref": "y",
    "x": '1991-01-01',
    "y": 2,
    "sizex": 0.5,
    "sizey": 0.5,
    "xanchor": "center",
    "yanchor": "middle"
  },
]
})

The image is there, but just really really really tiny. On date x-axes, the sizex is expected to be in milliseconds.

Here’s your image with a width of 2 days:

1 Like