#!/usr/bin/env python # coding: utf-8 # ## `Free` scales on a faceted plot # In[1]: import pandas as pd from lets_plot import * LetsPlot.setup_html() # In[2]: data = pd.read_csv('https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/mpg2.csv') data.head(3) # In[3]: p = (ggplot(data, aes(x="engine horsepower", y="engine displacement (cu. inches)")) + geom_point(aes(color="origin of car")) + theme_grey()) p + ggsize(800, 350) # ### Faceted plot # In[4]: fp = p + ggsize(800, 500) # #### `facet_grid()` with `fixed` scales (the default) # # Scales are constant across all panels. # In[5]: fp + facet_grid(y='origin of car') # #### `facet_grid()` with `free` Y-scales # In[6]: fp + facet_grid(y='origin of car', scales='free_y') # #### `facet_wrap()` with `fixed` scales (the default) # # Scales are constant across all panels. # In[7]: fp + facet_wrap(facets="number of cylinders", order=1) # #### `facet_wrap()` with `free` scales along both axis # In[8]: fp + facet_wrap(facets="number of cylinders", order=1, scales='free')