Plot text annotation is too complex

Adding text annotation using arrow mark is extremely cumbersome. Perhaps there is simple way to add an arrow and text without adding a text mark, dot mark and a arrow mark.

In my test case, I would like to add a simple curved down arrow and show text annotation.

Itā€™s certainly an area where we could make things easier. Donā€™t hesitate to share concrete examples of what you want to achieve and what the difficulties are. For me, itā€™s when I want a mix of data space and screen space; for example, to link a text that is positioned on the top-right of the frame, to a point at data coordinates (x, y).

The simplest solution I can think of is do a ā€˜Plot.annotationā€™ that only gives a location where the annotation needs to be attached.

Similar to how the text is attached in this chart:


        Plot.text(data.slice(4,5), {
          x: "Size of holding",
          y: "No of households",
          text: ['Only few families \n own large farmlands'],
          dx: 10,
          dy: -40,
          fill: "hsl(348, 100%, 70%)",
        })
  

I made an attempt at plot annotations in my recent notebook. I ended up creating an array of objects to represent the annotations, and then an arrow and text mark to consume that data. It ended up being more complicated than I initially planned, as I wanted to control:

  1. arrow head x
  2. arrow tail x + y
  3. text
  4. text start x + y

Then I had to do lots of customization to deal with the width and height of the text block, where everything moved when resized, how it should collapse at small screen sizes, etc.

Might try to bundle some of this into a Plot plugin, but for small screen sizes I rely on the caption field which would be hard in a plugin.

2 Likes

@RLesser I really love what you did in your wordle, 15 Million tweets notebook.

Perhaps using SVG expandable modal window could used for visualizations with limited screen space. When a user mouses over an item then a window modal window shows the annotation text.

Look forward playing with plot annotation plugin in future.