Stay organized with collections Save and categorize content based on your preferences.
Visualize graphs using BigQuery DataFramesThis document demonstrates how to plot various types of graphs by using the BigQuery DataFrames visualization library.
The bigframes.pandas
API provides a full ecosystem of tools for Python. The API supports advanced statistical operations, and you can visualize the aggregations generated from BigQuery DataFrames. You can also switch from BigQuery DataFrames to a pandas
DataFrame with built-in sampling operations.
The following example reads data from the bigquery-public-data.ml_datasets.penguins
table to plot a histogram on the distribution of penguin culmen depths:
The following example uses data from the bigquery-public-data.noaa_gsod.gsod2021
table to plot a line chart of median temperature changes throughout the year:
The following example uses the bigquery-public-data.usa_names.usa_1910_2013
table to track name popularity in US history and focuses on the names Mary
, Emily
, and Lisa
:
The following example uses the bigquery-public-data.ml_datasets.penguins
table to visualize the distribution of penguin sexes:
The following example uses the bigquery-public-data.new_york_taxi_trips.tlc_yellow_trips_2021
table to explore the relationship between taxi fare amounts and trip distances:
BigQuery DataFrames downloads data to your local machine for visualization. The number of data points to be downloaded is capped at 1,000 by default. If the number of data points exceeds the cap, BigQuery DataFrames randomly samples the number of data points equal to the cap.
You can override this cap by setting the sampling_n
parameter when plotting a graph, as shown in the following example:
sampling_n
parameter has no effect on histograms because BigQuery DataFrames bucketizes the data on the server side for histograms. Advanced plotting with pandas and Matplotlib parameters
You can pass in more parameters to fine tune your graph like you can with pandas, because the plotting library of BigQuery DataFrames is powered by pandas and Matplotlib. The following sections describe examples.
Name popularity trend with subplotsUsing the name history data from the area chart example, the following example creates individual graphs for each name by setting subplots=True
in the plot.area()
function call:
Using data from the scatter plot example, the following example renames the labels for the x-axis and y-axis, uses the passenger_count
parameter for point sizes, uses color points with the tip_amount
parameter, and resizes the figure:
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4