3

I am trying to create Vega charts in python using Vincent. Is there a way to add a title to the charts? For some reason I cannot find any chart examples created with Vincent and/or Vega that have a chart title on top.

Here is example code from the Vincent website:

import vincent
vincent.core.initialize_notebook()

# dicts of iterables
cat_1 = ['y1', 'y2', 'y3', 'y4']
index_1 = range(0, 21, 1)
multi_iter1 = {'index': index_1}
for cat in cat_1:
    multi_iter1[cat] = [random.randint(10, 100) for x in index_1]

bar = vincent.Bar(multi_iter1['y1'])
bar.axis_titles(x='Index', y='Value')
bar.width=700
bar.height=500
bar.display()

I have tried to do things like bar.title="Chart Title" without success.

VividD
  • 10,456
  • 6
  • 64
  • 111
bobfet1
  • 1,603
  • 21
  • 22
  • I'm also looking for a built-in title feature. For now my solution is to create a text mark containing the title and put it with the chart marks within the same group so they share the space. – floribon Jul 22 '15 at 10:16

1 Answers1

1

Got same demand then try to find method like 'set_title' in vincent source code... and no result found. But the 'legend' method may be an alternative of title function, like

bar.legend(title='test')
Richard
  • 11
  • 1