Code Monkey home page Code Monkey logo

plotly_barchart3d's People

Contributors

aymericferreira avatar dependabot[bot] avatar pre-commit-ci[bot] avatar serge-tochilov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

plotly_barchart3d's Issues

Example does not work

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.

Data indexing backwards

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).

Incorrect plotting from external file. Repeating C axis labels

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.
Plotly_barchart3D_issue

Make subplots with various barchart3D

Hi @AymericFerreira

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:

3d_printX.pdf
3d_printY.pdf

How can I subplot many barchart3D instances?

Thank you in advance!

index out of range

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]

Code run issue

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.

This is my code

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.