Настройка графического поля при наведении: Python для соответствия текстуPython

Программы на Python
Ответить
Anonymous
 Настройка графического поля при наведении: Python для соответствия тексту

Сообщение Anonymous »

Есть ли способ настроить текстовое поле при наведении на графике? Текст, который мне нужно отобразить в поле наведения, довольно длинный и не помещается на экране. Есть ли способ изменить размеры текстового поля при наведении или уменьшить текст, чтобы он уместился на экране?
Еще лучше было бы фиксированное поле сбоку от диаграммы, в котором будет отображаться соответствующее примечание при прокрутке этой точки данных, но я не знаю, как это сделать.

Вот пример того, что я пытаюсь сделать с текстом одинаковой длины.

Код: Выделить всё

import plotly.plotly as py
from plotly.graph_objs import *
import plotly
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

notes=["Clinton is also navigating delicate ties with Israel and the American Jewish community, an influential group of voters and donors. Israeli Prime Minister Benjamin Netanyahu, a fierce critic of the Obama administration's outreach to Iran, described the framework deal as a threat to the very survival of his nation.", "Fire crews in Cambria County were called to the Revloc duplex Friday morning and found much of the building engulfed in flames. Chief Deputy Coroner Jeffrey Leeds said at least seven people were in the duplex and all, but one, were able to get out safely.Witnesses said Jake Lewis, 24, re-entered the house to rescue 65-year-old Anna LaJudice. But father, Robert LaJudice, told The (Altoona) Mirror.Their bodies were later recovered. The deputy coroner said autopsies determined that both died from smoke and gas inhalation.", "As crews worked to tear down the rest of the home, Ott said she planned to attend a church service and say a prayer for the family."]
balance=[1000,2000,4000]
dates=[1,2,3]

data1 = Data([
Scatter(
x=dates,
y=balance,
mode='markers',
text=notes,
)
])
layout = Layout(
title='Hover over the points to see the text',autosize=True,
)
fig = Figure(data=data1, layout=layout,)

fig['layout'].update(
hovermode='closest',
showlegend=False,
autosize=True,

)
plot_url = py.plot(fig, filename='hover-chart-basic')
py.plot(fig, filename='hover-chart-basic')
Будем очень благодарны за любую помощь!

Подробнее здесь: https://stackoverflow.com/questions/294 ... o-fit-text
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Python»