Skip to content

Bubble Charts

A bubble chart is a scatter plot where marker size represents a third dimension of the data. Bubble charts show two variables on the x and y axes, with marker sizes proportional to a third numeric variable.

Writing prompts for Plotly Studio

You can create charts in Plotly Studio using natural language in different ways:

Ask a question - great for exploring your data:

Which factory produces the heaviest products?

Use a quick one-line prompt - concise and conversational:

Compare average weight by factory

Write structured detailed prompts - precise control and consistency:

Average Weight by Factory

Chart:
- Type: bar
- X: Factory location
- Y: Average weight

Data:
- Aggregation: average of weight by Factory location

Structured detailed prompts give you more control over chart type, data mappings, aggregations, and styling. Most examples on this page use this format.

Basic bubble chart example

Here's an example of how to create a basic bubble chart. The prompt specifies the chart type as well as the variables for the X and Y axes, plus a Size variable:

<Chart Title>

Chart:
- Type: bubble
- X: <variable_name>
- Y: <variable_name>
- Size: <numeric_variable>

The following example uses this prompt structure with the weight, length, and shipping_time variables from the built-in Plotly Studio dataset:

Product Weight vs Length by Shipping Time

Chart:
- Type: bubble
- X: Weight
- Y: Length
- Size: Shipping time

Data:
- Computed field: Shipping time calculated as the difference between Shipped date and Created date in days

Basic bubble chart example

Bubble chart with color dimension

Add color to a bubble chart to represent a fourth variable.

<Chart Title>

Chart:
- Type: bubble
- X: <variable_name>
- Y: <variable_name>
- Size: <numeric_variable>
- Color: <variable>

The following example uses this prompt structure with the weight, length, shipping_time, and defect variables from the built-in Plotly Studio dataset:

Product Analysis with Multiple Dimensions

Chart:
- Type: bubble
- X: Weight
- Y: Length
- Size: Shipping time
- Color: Defect

Data:
- Computed field: Shipping time calculated as the difference between Shipped date and Created date in days

Bubble chart with color dimension example

Bubble chart with continuous color scale

Use a continuous color scale to map numeric values to color gradients.

<Chart Title>

Chart:
- Type: bubble
- X: <variable_name>
- Y: <variable_name>
- Size: <numeric_variable>
- Color: <numeric_variable>

Chart styles:
- Use <scale_name> color scale

The following example uses this prompt structure with the weight, length, shipping_time variables from the built-in Plotly Studio dataset, using shipping_time for both size and color with a continuous scale:

Product Weight vs Length by Shipping Time

Chart:
- Type: bubble
- X: Weight
- Y: Length
- Size: Shipping time
- Color: Shipping time

Data:
- Computed field: Shipping time calculated as the difference between Shipped date and Created date in days

Chart styles:
- Use Viridis color scale

Bubble chart with continuous color scale example

Interactive controls

Add dropdowns, sliders, and other controls to make your bubble charts interactive. Controls let users filter and explore the data dynamically.

Product Weight vs Length Analysis

Chart:
- Type: bubble
- X: Weight
- Y: Length
- Size: Shipping time
- Color: Defect

Data:
- Computed field: Shipping time calculated as the difference between Shipped date and Created date in days

Options:
- Dropdown to select factory (All, Osaka, Seoul, Singapore, Los Angeles, Montreal, Randstad) - Default All
- Slider to filter by Weight range (0 to 3 kg) - Default full range

Bubble chart with interactive controls

Prompt keywords reference

Use these keywords and phrases in your prompts to customize your bubble chart.

Chart

Use a Chart: section in your prompt to define the basic structure of your bubble chart, including the chart type and how variables map to visual properties.

Chart:
- Type: bubble
- X: Weight
- Y: Length
- Size: Shipping time
- Color: Factory location
- Facet columns: Defect

Here are some keyword suggestions to use in this section:

Keyword/Phrase Description Example
Type Specify the chart type as bubble Type: bubble
X The variable to show on the horizontal axis X: Weight
Y The variable to show on the vertical axis Y: Length
Size Make bubble sizes proportional to a numeric variable Size: Shipping time
Color Color bubbles by different groups or continuous values Color: Factory location
Facet columns Create multiple subplots side-by-side for each category Facet columns: Factory location
Facet rows Create multiple plots stacked vertically by group Facet rows: Defect

Data

Use a Data: section in your prompt to specify how to transform, filter, or aggregate your data before visualization.

Data:
- Computed field: Shipping time calculated as the difference between Shipped date and Created date in days
- Aggregation: average of weight by Factory location

Here are some keyword suggestions to use in this section:

Keyword/Phrase Description Example
Aggregation Specify how to aggregate data Aggregation: average of weight by Factory location
Computed field Create new calculated fields from existing data Computed field: Shipping time calculated as the difference between Shipped date and Created date in days
Filter Filter data to show only specific records Filter to show only defect = true

Options

Use an Options: section in your prompt to add interactive controls that allow users to dynamically filter, transform, and visualize data without regenerating the chart.

Options:
- Dropdown to select factory (All, Osaka, Seoul) - Default All
- Slider to filter by Weight range (0 to 3 kg) - Default full range

Here are some keyword suggestions to use with this section. See Chart Controls for a complete list of control types and additional examples.

Keyword/Phrase Description Example
Dropdown Add a dropdown menu to filter by categories Dropdown to select factory (All, Osaka, Seoul) - Default All
Slider Add a slider to filter by numeric range Slider to filter by Weight range (0 to 3 kg) - Default full range

Chart styles

Use a Chart styles: section in your prompt to control the visual appearance and formatting of your bubble chart.

Chart styles:
- Use custom colors: #FF5733, #33FF57, #3357FF
- Use Viridis color scale
- Set opacity to 0.6
- Add a linear trend line

Here are some keyword suggestions to use in this section:

Keyword/Phrase Description Example
Custom colors Specify exact colors for categories or gradients Use custom colors: #FF5733, #33FF57, #3357FF
Color scale Specify color scale for continuous color mapping. See built-in color scales Use Viridis color scale
Reverse color scale Flip the direction of the color scale Reverse color scale
Opacity How see-through the bubbles are (0=invisible, 1=solid) Set opacity to 0.6
Max bubble size Set the maximum size for bubbles Set maximum bubble size to 50
Hover text What to show when hovering over bubbles Show Serial number on hover text
Axis labels Rename axis labels to be more readable Label x-axis as "Product Weight (kg)"
Label y-axis as "Product Length (cm)"
Trend line Add a line showing the overall trend Add a linear trend line
Logarithmic scale Use log scale for large ranges (useful for exponential data) Use logarithmic scale for the y-axis
Axis range Set minimum and maximum values for axes Set x-axis range from 0 to 3
Legend Control legend display and position Show legend at top right