adjust text python

Solutions on MaxInterview for adjust text python by the best coders in the world

showing results for - "adjust text python"
Lisa
18 Jan 2019
1mtcars = pd.read_csv('../../figures/mtcars.csv')
2def plot_mtcars(adjust=False, *args, **kwargs):
3    plt.figure(figsize=(9, 6))
4    plt.scatter(mtcars['wt'], mtcars['mpg'], s=15, c='r', edgecolors=(1,1,1,0))
5    texts = []
6    for x, y, s in zip(mtcars['wt'], mtcars['mpg'], mtcars['Car']):
7        texts.append(plt.text(x, y, s, size=9))
8    plt.xlabel('wt')
9    plt.ylabel('mpg')
10    if adjust:
11        plt.title('%s iterations' % adjust_text(texts, arrowprops=dict(arrowstyle="-", color='k', lw=0.5),
12                                                save_steps=False, save_prefix='/home/ilya/adjustText/examples/mtcars', **kwargs))
13    else:
14        plt.title('Original')
15plot_mtcars()
16
similar questions
queries leading to this page
adjust text python