Writing title for a figure with calculated values NetworkX
matplotlib, networkx, python
Solution
String formatting is what you are working for.
plt.title('<C>={}'.format(y))
migh work for this example. You can also do the usual fixed width padding and such as described in the docs. The `.format` form is the preferred way to do string formatting now as opposed to the `%` operator.
Problem
This should be a trivial question. But I am confused. I want to print a value calculated by NetworkX in the title of a figure: ``` y=nx.average_clustering(G) ``` How should I correctly write the line: ``` plt.title('<C>='y) ``` where the title is a combination of words and values calculated.