Skip to content

Line Charts

Line charts are useful for showing trends and changes over time or across ordered categories. You can create separate lines for different groups using color, and apply styles and customizations like line width, markers, and annotations.

Basic line example

Here's an example of how to structure a prompt to show how a value changes over time.

Create a line chart of <Y> over <X>.

The following example shows the average weight over time using the built-in Plotly Studio dataset:

Create a line chart of average weight by created date (daily).

Line chart example

Color by category

Create separate colored lines for different groups in your data to compare trends across categories.

Create a line chart of <Y> over <X>, color by <Column>.

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

Create a line chart of average weight by created date (daily), color by defect.

Line chart with color by category example

Control markers

Show or hide markers on your line chart to highlight individual data points along the line.

Create a line chart of <Y> over <X>. Hide markers.

The following example uses this prompt structure with the weight and created_date columns from the built-in Plotly Studio dataset to show data points along the trend line:

Create a line chart of average weight by created date (daily). Hide markers.

Line chart with markers example

Sparklines

Sparklines are small, minimal line charts that show trends at a glance. Create sparklines by using separate rows for each category and hiding axes and gridlines.

Create a line chart of <Y> over <X>.
Facet vertically by <Column>.
Hide axes, gridlines, and subplot labels.

The following example uses this prompt structure with the weight, created_date, and factory_location columns from the built-in Plotly Studio dataset to create sparklines:

Create a line chart of average weight by created date (daily).
Facet vertically by factory location.
Hide axes, gridlines, and subplot labels.

Sparklines example

Styled line plots

Customize the appearance of your line charts with colors and dash patterns.

Create a line chart of <Y> over <X>, color by <Column>.
Use different dash patterns for each <Column>.

The following example shows customized line styling using the built-in Plotly Studio dataset:

Create a line chart of average weight by created date (daily), color by defect.
Use different dash patterns for defect and no defect.

Styled line chart example

Line shape interpolation

Control how lines connect data points using different interpolation methods like linear, spline (curved), or step patterns.

Create a line chart of <Y> over <X>. Use <line_shape> lines.
Create a line chart of average weight by created date (daily).
Use spline lines.

Spline line chart

Create a line chart of average weight by created date (daily).
Use linear lines.

Linear line chart

Create a line chart of average weight by created date (daily).
Use hv lines.

HV line chart

Create a line chart of average weight by created date (daily).
Use vh lines.

VH line chart

Create a line chart of average weight by created date (daily).
Use hvh lines.

HVH line chart

Create a line chart of average weight by created date (daily).
Use vhv lines.

VHV line chart

Adding annotations

Add text annotations to highlight specific points or trends in your line chart.

Create a line chart of <Y> over <X>, color by <Column>.
Add annotation "<text>" at <location>.

The following example shows an annotated line chart using the built-in Plotly Studio dataset:

Create a line chart of average weight by created date (daily), color by defect.
Add annotation "Highest point" at the highest point.

Line chart with annotations example

Interactive controls

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

Create a line chart of average weight by created date (daily), color by defect.
Add a dropdown to select factory
(All, Osaka, Seoul, Singapore, Los Angeles, Montreal, Randstad) - Default All.
Add a date range picker to filter by date range - Default last 90 days.

Line chart with interactive controls

Prompt keywords reference

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

Chart

Here are some keyword suggestions to create and customize a chart:

Keyword/Phrase Description Example
X The column to show on the horizontal axis created date
Y The column to show on the vertical axis average weight
Color Create separate colored lines for different groups color by factory location
Facet rows Create multiple plots stacked vertically by group facet vertically by factory location
Facet columns Create multiple plots side-by-side by group facet by defect

Data

Specify data instructions in your prompt to transform, filter, or aggregate your data before visualization.

Calculate average weight by created date (daily).
Calculate shipping days as the difference between
shipped date and created date in days.

Here are some keyword suggestions:

Keyword/Phrase Description Example
Aggregation Specify how to aggregate data average weight by created date (daily)
Computed field Create new calculated fields from existing data calculate shipping days 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

Specify options in your prompt to add interactive controls that allow users to dynamically filter, transform, and visualize data without regenerating the chart.

Add a dropdown to select factory (All, Osaka, Seoul, Singapore) - Default All.
Add a date range picker to filter by date range - Default last 90 days.

Here are some keyword suggestions. See App Controls for a complete list of control types and additional examples.

Keyword/Phrase Description Example
Dropdown Add a dropdown menu to filter by categories Add a dropdown to select factory (All, Osaka, Seoul) - Default All
Date range picker Add a date range selector Add a date range picker to filter by date range - Default last 90 days

Chart styles

Specify chart styles in your prompt to control the visual appearance and formatting of your line chart.

Use custom colors: #FF5733, #33FF57.
Set line width to 3.
Use spline lines.
Show markers.

Here are some keyword suggestions:

Keyword/Phrase Description Example
Custom colors Specify exact colors for lines Use custom colors: #FF5733, #33FF57
Hover text What to show when hovering over points Show serial number on hover
Axis labels Customize the text shown on the axes Label x-axis as "Production Date"
Label y-axis as "Average Weight (kg)"
Background color Set the background color of the plot Set background color to lightgray
Grid lines Show or hide grid lines on the plot Hide grid lines
Color scale Specify color scale for continuous color mapping. See built-in color scales Use Viridis color scale
Line width Set the thickness of the line Set line width to 3
Dash patterns Use different line styles (solid, dashed, dotted) Use different dash patterns for each defect
Line shape Control how lines connect points (linear, spline, step) Use spline lines
Markers Show or hide markers on the line to highlight data points Show markers
Hide markers
Marker size Set a fixed size for all markers Set marker size to 12
Marker symbol Set a specific shape for all markers. See marker style options Use square markers
Marker opacity How see-through the markers are (0=invisible, 1=solid) Set marker opacity to 0.5
Text on points Display text labels directly on data points Show average weight as text on points
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 100
Legend Control legend display and position Show legend at top right
Annotations Add text labels to highlight specific points or trends Add annotation "Highest point" at the highest point