Skip to content

Commit

Permalink
added color to matplotlib 3D bar graph
Browse files Browse the repository at this point in the history
  • Loading branch information
SamPom100 committed Apr 19, 2020
1 parent ecadf51 commit ebdb0a8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"python.pythonPath": "C:\\Users\\SamPom100\\AppData\\Local\\Programs\\Python\\Python37\\python.exe"
"python.pythonPath": "/usr/bin/python3"
}
Binary file modified src/__pycache__/GUI.cpython-37.pyc
Binary file not shown.
Binary file modified src/__pycache__/scrolly.cpython-37.pyc
Binary file not shown.
9 changes: 6 additions & 3 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import yfinance as yf
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import cm
from PIL import Image
from GUI import *
from scrolly import *
Expand Down Expand Up @@ -177,8 +178,10 @@ def threedeegraph(object):
# the bars' heights
dz = eg.values.ravel()

# plot
ax.bar3d(xpos, ypos, zpos, dx, dy, dz)
# plot and color
values = np.linspace(0.2, 1., xpos.ravel().shape[0])
colors = cm.rainbow(values)
ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color=colors)

# put the column / index labels
ax.w_yaxis.set_ticklabels(eg.columns)
Expand All @@ -188,7 +191,7 @@ def threedeegraph(object):
ax.set_xlabel('Strike')
ax.set_ylabel('Date')
ax.set_zlabel('Open Interest')
fig.colorbar(surf1, ax=ax1, shrink=0.5, aspect=5)
#fig.colorbar(surf1, ax=ax1, shrink=0.5, aspect=5)

plt.show()

Expand Down

0 comments on commit ebdb0a8

Please sign in to comment.