Data Science & ML

Interactive Visualizations with Plotly

Plotly Express, interactive charts, dashboards, animations, geographic maps, export

18 interview questionsยท
Mid-Level
1

What is the main difference between Plotly Express and Plotly Graph Objects?

Answer

Plotly Express is a high-level API that allows creating charts in a single line of code with simple parameters. Plotly Graph Objects is the low-level API offering complete control over every chart element. Plotly Express uses Graph Objects internally, which allows switching between them to further customize charts.

2

How to create a scatter plot with Plotly Express from a Pandas DataFrame?

Answer

The px.scatter() function takes a DataFrame and uses x and y parameters to specify which columns to display on each axis. This concise syntax allows quickly creating interactive visualizations without complex configuration. Optional parameters like color, size and hover_data allow enriching the chart.

3

Which Plotly Express parameter allows coloring points according to a categorical variable?

Answer

The color parameter in Plotly Express automatically assigns distinct colors to each unique value of a categorical variable. Plotly generates an interactive legend and uses a default color palette optimized for visual distinction. This parameter also works with numerical variables to create a color gradient.

4

How to display a Plotly chart in a Jupyter notebook?

5

How to export a Plotly chart to HTML format for sharing?

+15 interview questions

Master Data Science & ML for your next interview

Access all questions, flashcards, technical tests, code review exercises and interview simulators.

Start for free