Skip to content

added appropriate colorbar max and min values, edges_color to param for line coloring, and making code more clear #551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 22, 2016

Conversation

Kully
Copy link
Contributor

@Kully Kully commented Aug 19, 2016

…or line coloring, and making code more clear
@@ -3305,7 +3305,7 @@ def _trisurf(x, y, z, simplices, show_colorbar, colormap=None,
color_func[index] = FigureFactory._label_rgb(foo)

mean_dists = np.asarray(color_func)
else:
elif hasattr(color_func, '__call__'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐄 Why not just elif color_func is not None?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just elif color_func is not None?

Your way makes sense upon closer inspection. Actually, I think else would work as well, since if color_func was a function, it would therefore not be None nor a list/array

@theengineear
Copy link
Contributor

Cool, ping me when you get that test passing again for a final review?

@Kully
Copy link
Contributor Author

Kully commented Aug 22, 2016

@theengineear I made all your edits and additionally switched x[:2] to just x[0] for x, y and z as plotting one invisible point also works for the colorbar's functionality. I also increased version number and will update in CHANGELOG after we merge.

Whoop!

@theengineear
Copy link
Contributor

@Kully did you mean to edit plotly/tests/test_optional/temp-plot.html?

@theengineear
Copy link
Contributor

Great! 💃 after you respond to #551 (comment).

@Kully
Copy link
Contributor Author

Kully commented Aug 22, 2016

did you mean to edit plotly/tests/test_optional/temp-plot.html?

So I accedentally pushed that temp-chart one fateful day ago. Chelsea didn't think it was a big deal iirc but everytime I rune nosetests in the test_optional dir, it shows that file as modified. Can I actually just delete what I pushed? Or do it after the PR?

@theengineear
Copy link
Contributor

Nah! Let's revert it! It's never a good idea to commit things you don't mean to! You can either:

  1. make a new commit.
  2. refact that commit using an interactive rebase.

Let me know if you need help with either.

@Kully
Copy link
Contributor Author

Kully commented Aug 22, 2016

make a new commit.

Let's do this.

@Kully Kully merged commit 809037b into master Aug 22, 2016
@Kully Kully deleted the trisurf-colorbar-range branch August 22, 2016 18:10
@empet
Copy link

empet commented Aug 22, 2016

I don't think that you can draw a Scatter3d trace defined only by one point.

By https://plot.ly/python/reference/#scatter3d-x
x, y, z must be lists, numpy arrays or pandas timeseries.
Moreover, the length of x, y, z should be equal to the length of the list color.

In this colorbar definition the above conditions are violated:

colorbar = graph_objs.Scatter3d(
            x=x[0],
            y=y[0],
            z=z[0],
            mode='markers',
            marker=dict(
                size=0.1,
                color=[min_mean_dists, max_mean_dists],
                colorscale=colorscale,
                showscale=True),
            hoverinfo='None',
            showlegend=False
        )

I defined a very simple Plotly plot defining a Scatter3d instance like this one and no colorbar is plotted.

@Kully
Copy link
Contributor Author

Kully commented Aug 22, 2016

I don't think that you can draw a Scatter3d trace defined only by one point.

By https://plot.ly/python/reference/#scatter3d-x
x, y, z must be lists, numpy arrays or pandas timeseries.
Moreover, the length of x, y, z should be equal to the length of the list color.

In this colorbar definition the above conditions are violated:

colorbar = graph_objs.Scatter3d(
x=x[0],
y=y[0],
z=z[0],
mode='markers',
marker=dict(
size=0.1,
color=[min_mean_dists, max_mean_dists],
colorscale=colorscale,
showscale=True),
hoverinfo='None',
showlegend=False
)
I defined a very simple Plotly plot defining a Scatter3d instance like this one and no colorbar is plotted.

I think the difference is that the .create_trisurf function is not just using Scatter3d but also creating the trisurf, which may explain why the colorbar is visible for me.

@empet
Copy link

empet commented Aug 22, 2016

@Kully I tested with a trisurf too, and the colorbar is not displayed.

@Kully
Copy link
Contributor Author

Kully commented Aug 22, 2016

@Kully I tested with a trisurf too, and the colorbar is not displayed.

Let's wait till the pip package gets updated (I updated the version number) and we'll see what's up with it then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants