Quadratic Docs
  • Getting started
  • Examples
  • Open Quadratic
  • Quadratic AI
    • Getting started
    • Generate code
    • Generate data
    • Import PDFs
    • Import images
    • Security
  • Connections
    • SQL - getting started
    • PostgreSQL
    • MySQL
    • MS SQL Server
    • Parametrize queries
    • SQL AI assistant
    • Security
    • API requests
    • Request a connection
  • Python
    • Getting started
    • Reference cells
    • Return data to the sheet
    • Packages
    • Make an API request
    • Clean data
    • Charts/visualizations
    • Manipulate data
  • Javascript
    • Getting started
    • Reference cells
    • Return data to the sheet
    • API Requests
    • Charts/visualizations
    • Packages
  • Formulas
    • Getting started
    • AI assistant
    • Reference cells
    • Functions and operators
    • Arrays
    • Criteria
    • Wildcards
  • Spreadsheet
    • Navigating
    • Files
    • Shortcuts
    • Insert/delete rows and columns
    • Data validation
    • Present & share
    • Date-time formatting
    • Browser compatibility
  • Teams
    • Manage your team
    • Private files
    • Collaboration
    • Embedded sheets
  • Import data
    • SQL connections
    • API requests
    • Drag and drop .CSV
    • Drag and drop .Parquet
    • Import Excel files
  • Self hosting
    • Getting started
    • Docker
    • AWS
    • Azure
    • Google Cloud Platform
    • Bring your own AI
    • Other hosting
  • Quadratic for Education
    • Overview
    • Enrolling in the education plan
    • Teachers
    • Students
    • Researchers
    • Education FAQ
  • Company
    • About
    • Quadratic is source available
    • Brand assets
  • GitHub
  • Blog
  • Twitter
  • Discord
Powered by GitBook
On this page
  • Getting started
  • 1. Create and display a chart
  • Line charts
  • Bar charts
  • Histograms
  • Scatter plots
  • Heatmaps
  • More chart types
  • 2. Styling
  • 3. Chart controls

Was this helpful?

  1. Python

Charts/visualizations

Glean insights from your data, visually.

PreviousClean dataNextManipulate data

Last updated 7 months ago

Was this helpful?

Create beautiful visualizations using our in-app Plotly support. Plotly support works just as you're used to in Python, displaying your chart straight to the spreadsheet.

Getting started

Building charts in Quadratic is centered around Python charting libraries, starting with Plotly. Building charts in Plotly is broken down into 3 simple steps:

1. Create and display a chart

Line charts

# import plotly
import plotly.express as px

# replace this df with your data
df = px.data.gapminder().query("country=='Canada'")

# create your chart type, for more chart types: https://plotly.com/python/
fig = px.line(df, x="year", y="lifeExp", title='Life expectancy in Canada')

# make chart prettier
fig.update_layout(
    plot_bgcolor="White",
)

# display chart 
fig.show()

Bar charts

import plotly.express as px

# replace this df with your data
df = px.data.gapminder().query("country == 'Canada'")

# create your chart type, for more chart types: https://plotly.com/python/
fig = px.bar(df, x='year', y='pop')

# make chart prettier
fig.update_layout(
    plot_bgcolor="White",
)

# display chart
fig.show()

Histograms

# Import Plotly
import plotly.express as px

# Create figure - replace df with your data
fig = px.histogram(df, x = 'output')

# Display to sheet 
fig.show()

Scatter plots

import plotly.express as px

# replace df, x, and y and color with your data
fig = px.scatter(df, x="col1", y="col2", color="col3")
fig.update_traces(marker_size=10)
fig.update_layout(scattermode="group")
fig.show()

Heatmaps

# Import library
import plotly.express as px

# Assumes 2d array Z
fig = px.imshow(Z, text_auto=True)

# Display chart
fig.show()

More chart types

2. Styling

# Example chart styling options to get started
fig.update_layout(
    xaxis=dict(
        showline=True,
        showgrid=False,
        showticklabels=True,
        linecolor='rgb(204, 204, 204)',
        linewidth=2,
        ticks='outside',
        tickfont=dict(
            family='Arial',
            size=12,
            color='rgb(82, 82, 82)',
        ),
    ),
    yaxis=dict(
        showgrid=False,
        zeroline=False,
        showline=False,
        showticklabels=True,
    ),
    autosize=False,
    showlegend=False,
    plot_bgcolor='white',
    title='Historical power usage by month (1985-2018)'
)

3. Chart controls

Resize by dragging the edges of the chart.

For more chart types, explore the Plotly docs:

For more styling, explore the Plotly styling docs:

https://plotly.com/python/
https://plotly.com/python/styling-plotly-express/
Create and display a chart
Style your chart
Chart controls