aymericferreira / plotly_barchart3d Goto Github PK
View Code? Open in Web Editor NEWA function to plot barchart in 3D in plotly
License: GNU General Public License v3.0
A function to plot barchart in 3D in plotly
License: GNU General Public License v3.0
First of all, your code seems really good and helpful, it is everything I wanted. However, the examples provided does not compile with the current version of the code. The error message I get is
"IndexError: list index out of range"
Also, I cannot produce a plot like the one in the first example. I always get a diagonal bar arrangement, instead of grid one, like in the examples.
Again, congratulations on this code.
bar_charts3d_from_array is indexing the data backwards. It is incrementing x_min in the idx2 loop and y_min in the idx loop. This works with the pandas data but for a standard array it causes the X and Y axis to be flipped and the tick mark labels to be wrong.
Here's my version of the code with variable initialization.
x_min = 0
y_min = 0
for idx, x_data in enumerate(x_df_uniq):
if color == 'x':
color_value = colors[idx % 9]
for idx2, y_data in enumerate(y_df_uniq):
if color == 'x+y':
color_value = colors[(idx + idx2 * len(y_df.unique())) % 9]
elif color == 'y':
color_value = colors[idx2 % 9]
x_max = x_min + step
y_max = y_min + step
z_max = z_df[idx + idx2 * len_x_df_uniq]
if z_max is not None :
mesh_list.append(
generate_mesh(
x_min, x_max, y_min, y_max, z_min, z_max, color_value, flat_shading,
hover_info,
),
)
y_min += 2 * step
x_min += 2 * step
y_min = 0
And here's a simple program that exemplifies the issue:
xdf = pd.Series([*range(1,5)])
ydf = pd.Series([*range(1,16)])
z = np.array([ [None]*15 for i in range(4)])
z[0,6] = 64
z[0,9] = 32
z[1,8] = 38
z[1,10] = 23
z[2,10] = 65
z[2,12] = 34
z[3,12] = 20
z[3,14] = 9
z = np.array(z).flatten('F')
zdf = pd.Series(z)
fig = plotly_bar_charts_3d(xdf, ydf, zdf, z_min=0,x_title='Rate', y_title='Time', color='x')
fig.update_layout(
autosize=False,
width=1000,
height=1000,)
fig.show()
Also, note I modified the code to handle sparse arrays as I didn't see how the code figured out if the array was sparse (thought I didn't put much time into figuring it out either).
I ran into two issues. The first was a naming issue between your examples and the code. Your README examples import plotly_barcharts_3d but in the code it's plotly_bar_charts_3d. Also, the data file imported in examples 2 and 3 is dataExample.csv not dataBar.csv
The second issue is more troublesome. The code doesn't seem to be handling the C axis correctly. It's duplicating C. See the attached screenshot.
I am trying to use the project https://github.com/AymericFerreira/Plotly_barchart3D to make a comparative while performance is analized in different scenarios. However, I am not able to make a subplot of various barchart3D graphs. I have the following code:
figs = make_subplots(rows=1, cols=2, specs=[ [{'type': 'scene'}, {'type': 'scene'}]])
figs.add_trace(fig.data[0], row=1, col=1)
figs.add_trace(fig2.data[0], row=1, col=2)
Where fig and fig2 are two instances of barchart3D. While I execute this code, I obtained the following output:
3d_print.pdf
Where fig and fig2 are:
How can I subplot many barchart3D instances?
Thank you in advance!
could you please check with these values once
features = [2,3,5,10,20]
neighbours = [31,24,10,28,48]
accuracies = [0.9727,0.9994,0.9994,0.9995,0.9995]
When I run the project it works fine but when I write the code into my real project it runs on other ports with my expected ports.
so my question is how to stop running other ports except for the defined ports.
features = [2, 3, 5, 10, 20]
neighbours = [31, 24, 10, 28, 48]
accuracies = [0.9727, 0.9994, 0.9994, 0.9995, 0.9995]
plotly_barcharts_3d(features, neighbours, accuracies,
x_title="Features", y_title="Neighbours", z_title="Accuracy").show()
xdf = pd.Series([1, 10])
ydf = pd.Series([2, 4])
zdf = pd.Series([10, 30, 20, 45])
fig = plotly_barcharts_3d(xdf, ydf, zdf, color='x+y')
app = dash.Dash()
app.layout = html.Div([
dcc.Graph(id='3d-graph', figure=fig)
])
app.run_server(debug=True, port=8010)
thanks in advance
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.