1

I have this dataframe:

giorno ChiusureNeg ChiusurePos close-open Probabilità ASKBID
1 -29 34 0.1260277590000385 0.5396825396825397 NaN
2 -21 26 1.3141801329999225 0.5531914893617021 BID
3 -28 35 5.392071843000082 0.5555555555555556 BID
4 -29 19 -6.59752959299999 -0.6041666666666666 ASK
5 -26 21 -4.095628002000012 -0.5531914893617021 ASK
6 -25 22 5.528463614999879 -0.5319148936170213 NaN
7 -29 35 7.13160866299998 0.546875 NaN
8 -31 32 -1.0534575520001965 0.5079365079365079 NaN
9 -25 22 -0.882005634999814 -0.5319148936170213 NaN

and I want to plot :

pivotD["close-open"].plot(figsize=(30,7),title="titolo",kind='bar')

with different color in order the value of ASKBID. Is it possible? thanks in advance

1 Answer 1

1

Use color parameter:

colors = pivotD['ASKBID'].replace({np.nan: 'blue', 'BID': 'red', 'ASK': 'green'})
pivotD['close-open'].plot(figsize=(30,7), title='titolo', kind='bar', color=colors)
plt.show()

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

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.