Skip to content
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

Term Entry - .mesh3d() - Plotly #5617

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

danitellini
Copy link
Contributor

Description

Summary of Change:

Topic: Python Plotly graph_object .mesh3d() function
Files created: docs/content/plotly/concepts/graph-objects/terms/mesh3d/mesh3d.md
Files added: docs/media/mesh3d-example-result.png and docs/media/mesh3d-dataset-sphere.png
Description: Created a new Term Entry for Python Plotly graph_object .mesh3d() function

Open issue, and a great way to practice and learn is to teach!

Issue Solved

Closes #5178

Type of Change

  • Adding a new entry
  • Editing an existing entry (fixing a typo, bug, issues, etc)
  • Updating the documentation

Checklist

  • All writings are my own.
  • My entry follows the Codecademy Docs style guide.
  • My changes generate no new warnings.
  • I have performed a self-review of my own writing and code.
  • I have checked my entry and corrected any misspellings.
  • I have made corresponding changes to the documentation if needed.
  • I have confirmed my changes are not being pushed from my forked main branch.
  • I have confirmed that I'm pushing from a new branch named after the changes I'm making.
  • I have linked any issues that are relevant to this PR in the Issues Solved section.

@mamtawardhani mamtawardhani self-assigned this Nov 12, 2024
@mamtawardhani mamtawardhani added new entry New entry or entries status: under review Issue or PR is currently being reviewed plotly Python:Plotly entries labels Nov 12, 2024
@danitellini
Copy link
Contributor Author

danitellini commented Nov 12, 2024

@mamtawardhani I have no idea my last commit became the title of the pull request 🤕 This one has beat my head in for sure haha I've fixed it

@danitellini danitellini changed the title initial commit, messed up branch commits, deleted and created new Term Entry - .create_distplot() - Plotly Nov 12, 2024
@danitellini danitellini changed the title Term Entry - .create_distplot() - Plotly Term Entry - .mesh3d() - Plotly Nov 12, 2024
Copy link
Collaborator

@mamtawardhani mamtawardhani left a comment

Choose a reason for hiding this comment

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

Hey @danitellini thank you for contributing to Codecademy Docs, the entry is nicely written! 😄

I've suggested a few changes, could you please review and modify those at your earliest convenience? Thank you! 😃

- 'paths/data-science-foundations'
---

**`.Mesh3d()`** is a method in Plotly's `graph_objects` module that generates 3D mesh plots by defining vertices and connecting faces (triangles).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
**`.Mesh3d()`** is a method in Plotly's `graph_objects` module that generates 3D mesh plots by defining vertices and connecting faces (triangles).
**`.Mesh3d()`** is a method in Plotly's [`graph_objects`](https://www.codecademy.com/resources/docs/plotly/graph-objects) module that generates 3D mesh plots by defining vertices and connecting them with faces (typically triangles).

Comment on lines +24 to +34
Mesh3d(
x=x_values,
y=y_values,
z=x_values,
i=indices_i, # Optional
j=indices_j, # Optional
k=indices_k, # Optional
color='color_value', # Optional
opacity=opacity_value, # Optional
(...) # Optional
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Mesh3d(
x=x_values,
y=y_values,
z=x_values,
i=indices_i, # Optional
j=indices_j, # Optional
k=indices_k, # Optional
color='color_value', # Optional
opacity=opacity_value, # Optional
(...) # Optional
)
plotly.graph_objects.Mesh3d( x=None, y=None, z=None, i=None, j=None, k=None, color=None, opacity=None, ...)

Copy link
Collaborator

Choose a reason for hiding this comment

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

default values are None which should be mentioned

Comment on lines +37 to +40
- `x`, `y`, `z`: Arrays of vertex coordinates
- `i`, `j`, `k`: Arrays defining the triangles via indices pointing to the vertex arrays
- `color`: Sets the mesh color
- `opacity`: Sets the mesh transparency (0 to 1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- `x`, `y`, `z`: Arrays of vertex coordinates
- `i`, `j`, `k`: Arrays defining the triangles via indices pointing to the vertex arrays
- `color`: Sets the mesh color
- `opacity`: Sets the mesh transparency (0 to 1)
- `x`, `y`, `z`: Coordinates of the vertices in 3D space (arrays or lists).
- `i`, `j`, `k`: Indices that define the triangular faces, where each set of three indices corresponds to a triangle formed by the vertices defined by `x`, `y`, and `z`.
- `Color`: The color of the mesh, which can be a single color or an array of colors for each face.
- `opacity`: Controls the transparency of the mesh, ranging from 0 (fully transparent) to 1 (fully opaque).

Copy link
Collaborator

Choose a reason for hiding this comment

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

reframed and added some details

fig.show()
```

> Note: If you don't specify the triangle indices, the mesh will automatically be generated using algorithms like Delaunay triangulation. You can also use the `alphahull` parameter to control the generation without the indices: `alphahull = -1` - Uses Delauney triangulation; `alphahull = 0` - Computes the convex hull of the point set; `alphahull > 0` - Uses the alpha shape algorithm with the specified alpha value.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
> Note: If you don't specify the triangle indices, the mesh will automatically be generated using algorithms like Delaunay triangulation. You can also use the `alphahull` parameter to control the generation without the indices: `alphahull = -1` - Uses Delauney triangulation; `alphahull = 0` - Computes the convex hull of the point set; `alphahull > 0` - Uses the alpha shape algorithm with the specified alpha value.
> Note: If triangle indices (`i`, `j`, `k`) are not specified, the mesh will be automatically generated using algorithms like Delaunay triangulation. The `alphahull` parameter can be used to control the mesh generation process without the indices:
- `alphahull = -1`: Uses Delaunay triangulation.
- `alphahull = 0`: Computes the convex hull of the point set.
- `alphahull > 0`: Uses the alpha shape algorithm with the specified alpha value.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't usually use you and we


### Example 2

Dataset information can also be used to create the mesh. This visualizes a sphere by using vertex and face data from a CSV file:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Dataset information can also be used to create the mesh. This visualizes a sphere by using vertex and face data from a CSV file:
The dataset information can be used to create a 3D mesh plot, as demonstrated in the example below, which visualizes a sphere using vertex and face data from a CSV file:

Comment on lines +15 to +16
- 'paths/data-science'
- 'paths/data-science-foundations'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- 'paths/data-science'
- 'paths/data-science-foundations'

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let us only have 2 paths

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

Successfully merging this pull request may close these issues.

[Term Entry] Python Plotly- graph_objects .Mesh3d()
2 participants