Hi,
I would like to plot some text from Inputs.text()
. Notebook here: Plot text from Inputs.text() / Erdi | Observable
The text shows up in plot but letters overlap. Anyone can help with this?
Thank you!
Hi,
I would like to plot some text from Inputs.text()
. Notebook here: Plot text from Inputs.text() / Erdi | Observable
The text shows up in plot but letters overlap. Anyone can help with this?
Thank you!
Try this:
Plot.text([text], {x: 220, y: 3500, fontSize: 25})
Note the square brackets: [text]
, as opposed to just text
in your notebook
Generally, Plot
marks accept iterables as their first argument so that they can plot a whole list of items in one step. Now, your text
variable is a string, which is iterable, and the individual characters in the string are the items. Thus, those characters are all plotted at the some spot, namely {x: 220, y: 3500}
. Wrapping text
in brackets changes the iterable to an array whose single data point is the string that you want.
Thanks so much (for the solution and also for the context)!