Skip to content

Visualization of the plotly.py project's codebase #5233

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 167 additions & 0 deletions .codeboarding/on_boarding.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
```mermaid

graph LR

plotly_graph_objects["plotly.graph_objects"]

plotly_basedatatypes["plotly.basedatatypes"]

plotly_validators["plotly.validators"]

plotly_io["plotly.io"]

plotly_express["plotly.express"]

plotly_graph_objects -- "Uses" --> plotly_basedatatypes

plotly_graph_objects -- "Interacts with" --> plotly_validators

plotly_basedatatypes -- "Provides base for" --> plotly_graph_objects

plotly_basedatatypes -- "Invokes" --> plotly_validators

plotly_validators -- "Validates properties for" --> plotly_basedatatypes

plotly_io -- "Renders" --> plotly_graph_objects

plotly_express -- "Generates" --> plotly_graph_objects

click plotly_graph_objects href "https://github.com/plotly/plotly.py/blob/main/.codeboarding//plotly_graph_objects.md" "Details"

click plotly_io href "https://github.com/plotly/plotly.py/blob/main/.codeboarding//plotly_io.md" "Details"

click plotly_express href "https://github.com/plotly/plotly.py/blob/main/.codeboarding//plotly_express.md" "Details"

```

[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/GeneratedOnBoardings)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/demo)[![Contact](https://img.shields.io/badge/Contact%20us%20-%[email protected]?style=flat-square)](mailto:[email protected])



## Component Details



These five components represent the core functionality of `plotly.py` and are essential for its operation:

* `plotly.graph_objects`: This is the *definition* of a Plotly figure. Without it, there would be no structured way to represent plots, traces, or layouts. It's the language Plotly uses to describe visualizations.

* `plotly.basedatatypes`: This module provides the *foundation* and *enforcement* for `graph_objects`. It ensures that all Plotly objects behave consistently and that their properties are managed correctly. It's the underlying engine that makes `graph_objects` work.

* `plotly.validators`: Data integrity is paramount in plotting. This component *validates* all inputs, preventing errors and ensuring that the figures generated are consistent with the Plotly.js schema. It's the quality control mechanism.

* `plotly.io`: A plotting library is only useful if you can *see* and *share* the plots. This module handles all rendering and export functionalities, making the visualizations accessible in various environments and formats. It's the output mechanism.

* `plotly.express`: While `graph_objects` provides fine-grained control, `plotly.express` offers *ease of use* and *rapid prototyping*. It significantly lowers the barrier to entry for common plotting tasks, making Plotly more accessible to a wider audience, especially data scientists. It's the user-friendly interface.



### plotly.graph_objects

This is the central component for defining the structure of Plotly figures. It contains all the classes representing various plot types (traces like `Scatter`, `Bar`, `Heatmap`), layout properties (`Layout`, `XAxis`, `YAxis`), and animation frames. Users directly interact with `Figure` objects from this module to construct their visualizations.





**Related Classes/Methods**:



- <a href="https://github.com/plotly/plotly.py/blob/master/plotly/graph_objects/__init__.py#L1-L1" target="_blank" rel="noopener noreferrer">`plotly.graph_objects.__init__` (1:1)</a>

- <a href="https://github.com/plotly/plotly.py/blob/master/commands.py#L1-L1" target="_blank" rel="noopener noreferrer">`plotly.graph_objs` (1:1)</a>





### plotly.basedatatypes

This module provides the foundational abstract classes (`BasePlotlyType`, `BaseFigure`) that serve as the base for all objects within `plotly.graph_objects`. It implements the core mechanisms for property management, attribute validation, and fundamental figure operations (e.g., `update`, `add_trace`). It ensures consistency and proper behavior across all Plotly objects.





**Related Classes/Methods**:



- <a href="https://github.com/plotly/plotly.py/blob/master/plotly/basedatatypes.py#L1-L1" target="_blank" rel="noopener noreferrer">`plotly.basedatatypes` (1:1)</a>





### plotly.validators

This component is crucial for data integrity. It comprises a collection of validator classes that ensure all properties assigned to Plotly objects conform to the expected data types, ranges, and formats defined by the Plotly.js schema. It prevents invalid data from being used and provides informative error messages.





**Related Classes/Methods**:



- <a href="https://github.com/plotly/plotly.py/blob/master/_plotly_utils/basevalidators.py#L1-L1" target="_blank" rel="noopener noreferrer">`_plotly_utils.basevalidators` (1:1)</a>





### plotly.io

This module handles all input/output operations for Plotly figures. It is responsible for rendering figures to various formats (e.g., HTML, JSON, static images) and managing figure templates. It acts as the primary interface for saving, displaying, and exporting visualizations.





**Related Classes/Methods**:



- <a href="https://github.com/plotly/plotly.py/blob/master/plotly/io/__init__.py#L1-L1" target="_blank" rel="noopener noreferrer">`plotly.io.__init__` (1:1)</a>

- <a href="https://github.com/plotly/plotly.py/blob/master/plotly/io/_html.py#L1-L1" target="_blank" rel="noopener noreferrer">`plotly.io._html` (1:1)</a>

- <a href="https://github.com/plotly/plotly.py/blob/master/plotly/io/_json.py#L1-L1" target="_blank" rel="noopener noreferrer">`plotly.io._json` (1:1)</a>

- <a href="https://github.com/plotly/plotly.py/blob/master/plotly/io/_kaleido.py#L1-L1" target="_blank" rel="noopener noreferrer">`plotly.io._kaleido` (1:1)</a>

- <a href="https://github.com/plotly/plotly.py/blob/master/plotly/io/_orca.py#L1-L1" target="_blank" rel="noopener noreferrer">`plotly.io._orca` (1:1)</a>

- <a href="https://github.com/plotly/plotly.py/blob/master/plotly/io/_renderers.py#L1-L1" target="_blank" rel="noopener noreferrer">`plotly.io._renderers` (1:1)</a>





### plotly.express

This module provides a simplified, high-level API for quickly creating common statistical charts. It abstracts away the complexities of direct `plotly.graph_objects` construction, allowing users to generate plots with minimal code, often directly from data structures like pandas DataFrames.





**Related Classes/Methods**:



- <a href="https://github.com/plotly/plotly.py/blob/master/plotly/express/__init__.py#L1-L1" target="_blank" rel="noopener noreferrer">`plotly.express.__init__` (1:1)</a>

- <a href="https://github.com/plotly/plotly.py/blob/master/plotly/express/_core.py#L1-L1" target="_blank" rel="noopener noreferrer">`plotly.express._core` (1:1)</a>









### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq)
181 changes: 181 additions & 0 deletions .codeboarding/plotly_express.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
```mermaid

graph LR

Core_Charting_Engine["Core Charting Engine"]

Chart_Type_Definitions["Chart Type Definitions"]

Data_Preprocessing_and_Input_Handling["Data Preprocessing and Input Handling"]

Color_and_Styling_Management["Color and Styling Management"]

Image_Display_Utilities["Image Display Utilities"]

Trendline_Calculation["Trendline Calculation"]

Sample_Data_Provider["Sample Data Provider"]

Chart_Type_Definitions -- "Calls, Configures" --> Core_Charting_Engine

Data_Preprocessing_and_Input_Handling -- "Prepares Data, Provides Special Inputs" --> Core_Charting_Engine

Color_and_Styling_Management -- "Provides Styling Options, Influences Defaults" --> Core_Charting_Engine

Image_Display_Utilities -- "Provides Image Traces, Handles Image Data" --> Core_Charting_Engine

Trendline_Calculation -- "Calculates Trendlines, Integrates Trendlines" --> Core_Charting_Engine

Sample_Data_Provider -- "Provides Sample Data" --> Chart_Type_Definitions

Core_Charting_Engine -- "Requests Calculations" --> Trendline_Calculation

Core_Charting_Engine -- "Applies Styles" --> Color_and_Styling_Management

```

[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/GeneratedOnBoardings)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/demo)[![Contact](https://img.shields.io/badge/Contact%20us%20-%[email protected]?style=flat-square)](mailto:[email protected])



## Component Details



`plotly.express` is a high-level, simplified API built on top of `plotly.graph_objects` designed for quickly creating common statistical charts. It abstracts away the complexities of direct `plotly.graph_objects` construction, allowing users to generate plots with minimal code, often directly from data structures like pandas DataFrames.



### Core Charting Engine

This is the central orchestrator of `plotly.express`. It takes user data and arguments, processes them, and constructs `plotly.graph_objects` figures. It integrates functionalities from other modules like data handling, styling, and trendline calculations to generate a complete plot. It also manages default settings for plots.





**Related Classes/Methods**:



- <a href="https://github.com/plotly/plotly.py/blob/master/plotly/express/_core.py#L0-L0" target="_blank" rel="noopener noreferrer">`plotly.express._core` (0:0)</a>





### Chart Type Definitions

This component exposes the high-level API functions (e.g., `px.scatter`, `px.bar`) that users directly invoke to create specific chart types. It acts as a user-friendly facade, simplifying the complex underlying charting logic.





**Related Classes/Methods**:



- <a href="https://github.com/plotly/plotly.py/blob/master/plotly/express/_chart_types.py#L0-L0" target="_blank" rel="noopener noreferrer">`plotly.express._chart_types` (0:0)</a>





### Data Preprocessing and Input Handling

Manages the preparation, validation, and transformation of various input data formats and special arguments (like `IdentityMap`, `Constant`, `Range`) into a standardized structure suitable for the Core Charting Engine.





**Related Classes/Methods**:



- <a href="https://github.com/plotly/plotly.py/blob/master/plotly/express/_special_inputs.py#L0-L0" target="_blank" rel="noopener noreferrer">`plotly.express._special_inputs` (0:0)</a>





### Color and Styling Management

Provides a comprehensive set of predefined color palettes (discrete and sequential) and utilities for applying and managing color scales, symbols, line dashes, and pattern shapes. It enables extensive customization of chart aesthetics.





**Related Classes/Methods**:



- <a href="https://github.com/plotly/plotly.py/blob/master/commands.py#L0-L0" target="_blank" rel="noopener noreferrer">`plotly.express.colors` (0:0)</a>





### Image Display Utilities

Specializes in handling and rendering image-based visualizations, such as heatmaps and direct image displays. It provides the specific logic required for processing and presenting image data within the Plotly framework.





**Related Classes/Methods**:



- <a href="https://github.com/plotly/plotly.py/blob/master/plotly/express/_imshow.py#L0-L0" target="_blank" rel="noopener noreferrer">`plotly.express._imshow` (0:0)</a>

- <a href="https://github.com/plotly/plotly.py/blob/master/plotly/express/imshow_utils.py#L0-L0" target="_blank" rel="noopener noreferrer">`plotly.express.imshow_utils` (0:0)</a>





### Trendline Calculation

Contains the implementations for various statistical trendline calculations (e.g., Ordinary Least Squares, LOWESS). It provides the analytical backbone for adding regression and smoothing lines to charts.





**Related Classes/Methods**:



- <a href="https://github.com/plotly/plotly.py/blob/master/commands.py#L0-L0" target="_blank" rel="noopener noreferrer">`plotly.express.trendline_functions` (0:0)</a>





### Sample Data Provider

Offers a collection of readily available sample datasets. These datasets are primarily used for demonstration, testing, and quick prototyping, allowing users to explore `plotly.express` functionalities without external data.





**Related Classes/Methods**:



- <a href="https://github.com/plotly/plotly.py/blob/master/commands.py#L0-L0" target="_blank" rel="noopener noreferrer">`plotly.express.data` (0:0)</a>









### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq)
Loading