0

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:

enter image description here

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

2
  • what is type(roundi)? Commented Jul 1, 2018 at 22:16
  • class 'numpy.ndarray' Commented Jul 1, 2018 at 22:18

2 Answers 2

2

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]'
Sign up to request clarification or add additional context in comments.

Comments

0

Use this:

ax.set_title(r'Globales Minimum $\hat \beta$ = {}'.format(str(roundi) ), 
fontsize=20)

1 Comment

This would result in [ 0, -2,36] (two commas)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.