Reputation: 499
assume I've the following variable
roundi = theta_result_lasso.round(2)
[ 0. -2.36]
where theta_result_lasso.round are just two values.
The line for my plot title is
ax.set_title(r'Globales Minimum $\hat \beta$ = {}'.format(roundi), fontsize=20)
producing this:
is there a way to replace the "." after the zero by a "," and descreasing the disance between the two values as it should look like a "vector" ?
It should look like this:
[0, -2.36]
If you Need further informations, I'll provide an example
Upvotes: 0
Views: 154
Reputation: 3583
Use this:
ax.set_title(r'Globales Minimum $\hat \beta$ = {}'.format(str(roundi) ),
fontsize=20)
Upvotes: 0
Reputation: 318
If your array consist of two variables every time, the easiest would be to format your string something like the following
roundi = [0.0,-2.36]
titlestring = 'Globales Minimum $\hat \beta$ = [{:0.0f}, {:0.2f}]'.format(roundi[0],roundi[1])
The values in roundi
are accessed and formatted individually here.
This will result in the following formatting
'Globales Minimum $\\hat \x08eta$ = [0, -2.36]'
Upvotes: 2