I have been searched high and low to display only 2 digits of floating points. Here is a variable "enrichment", which is equal to 31.5925925926....... Is there any way just to display the following in matplotlib.pyplot?
Desired plot title:
ROC Curve; Enrichment factor 1% = 31.59
Here is the code
plt.title('ROC Curve; Enrichment factor 1% = '+str(enrichment))
This will show
ROC Curve; Enrichment factor 1% = 31.5925925926
Thanks!
Matplotlib is irrelevant here. Just use string formatting
plt.title('ROC Curve; Enrichment factor 1% = {:.2f}'.format(enrichment))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With