Plot styling using plot_pandas_GUI()
¶
You can try this notebook live by lauching it in Binder.This can take a while to launch, be patient. .
First we import pandas
and pandas_GUI
, and load some data. In this case we will load two time dependent Laser Induced Fluorescence (LIF) data sets.
import pandas as pd
from pandas_GUI import *
LIF = pd.read_csv('DataSets/LIF.csv')
LIF2 = pd.read_csv('DataSets/LIF2.csv')
Default plot of the two data sets¶
This is the plot made in the step-by-step example.
# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_1 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = LIF['time(s)'], y = LIF['Signal (V)'],
mode = 'lines', name = 'LIF1',)
Figure_1.add_trace(scat)
scat = go.Scatter(x = LIF2['time(s)'], y = LIF2['Signal (V)'],
mode = 'lines', name = 'LIF2',)
Figure_1.add_trace(scat)
Figure_1.update_xaxes(title= 'Time (s)', mirror = True)
Figure_1.update_yaxes(title= 'Signal (V)', mirror = True)
Figure_1.update_layout(title = 'Figure_1', template = 'simple_white')
Figure_1.show(config = {'toImageButtonOptions': {'format': 'svg'}})
Figure 1: This should display a live plotly plot that can be zoomed and show point values upon hovering. If you do not see a live plot the notebook is not running or trusted. Click on the 'Not Trusted' button in the Jupyter menu bar to trust the notebook.
Plot styling options¶
The plot styling options impact font, background, framing and color choices.
An image of the plot styling section (Tab 3) is shown below.
- Selecting
Display Mirror Axes
creates a frame all the way around the plot. - Selecting
Mirror Tick Marks
adds tick marks to the right and top axes. - The
Plot Styling
popup. Options aresimple_white
,ggplot2
,seaborn
,plotly
,plotly_white
,plotly_dark
,presentation
(bigger fonts),xgridoff
,ygridoff
,gridon
,simple_white+presentation
,simple_white+gridon
,simple_white+presentation+gridon
. - When
Aspect Ratio
is set toauto
the plot image will fill the output area of the cell and change size when the window changes size. If one of the aspect ratios is chosen then the size of the plot image is fixed in pixels.Large
will fill about 2/3 of an HD (1920X1080) screen.
The options available are a subset of all the plotly options. If you want slightly different format options you can edit the code created by the GUI and run it again.
The plots below illustrate the available plot styling options.¶
Default plot styling (simple_white)¶
No mirroring of axes or tick marks
# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_2 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = LIF['time(s)'], y = LIF['Signal (V)'],
mode = 'lines', name = 'LIF 1',)
Figure_2.add_trace(scat)
Figure_2.update_xaxes(title= 'Time (s)')
Figure_2.update_yaxes(title= 'Signal (V)')
Figure_2.update_layout(title = 'Default Plot Styling', template = 'simple_white')
Figure_2.show(config = {'toImageButtonOptions': {'format': 'svg'}})
Figure 2: Example of the default styling.
Mirror axes with ticks¶
# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_3 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = LIF['time(s)'], y = LIF['Signal (V)'],
mode = 'lines', name = 'LIF 1',)
Figure_3.add_trace(scat)
Figure_3.update_xaxes(title= 'Time (s)', mirror= 'ticks')
Figure_3.update_yaxes(title= 'Signal (V)', mirror= 'ticks')
Figure_3.update_layout(title = 'Mirror Axes with Ticks', template = 'simple_white')
Figure_3.show(config = {'toImageButtonOptions': {'format': 'svg'}})
Figure 3: Example of mirroring axes with tick marks.
ggplot2¶
# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_4 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = LIF['time(s)'], y = LIF['Signal (V)'],
mode = 'lines', name = 'LIF 1',)
Figure_4.add_trace(scat)
Figure_4.update_xaxes(title= 'Time (s)')
Figure_4.update_yaxes(title= 'Signal (V)')
Figure_4.update_layout(title = 'ggplot2 Styling', template = 'ggplot2')
Figure_4.show(config = {'toImageButtonOptions': {'format': 'svg'}})
Figure 4: Example of ggplot2 styling.
seaborn¶
# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_5 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = LIF['time(s)'], y = LIF['Signal (V)'],
mode = 'lines', name = 'LIF 1',)
Figure_5.add_trace(scat)
Figure_5.update_xaxes(title= 'Time (s)')
Figure_5.update_yaxes(title= 'Signal (V)')
Figure_5.update_layout(title = 'seaborn Styling', template = 'seaborn')
Figure_5.show(config = {'toImageButtonOptions': {'format': 'svg'}})
Figure 5: Example of seaborn styling.
plotly¶
# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_6 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = LIF['time(s)'], y = LIF['Signal (V)'],
mode = 'lines', name = 'LIF 1',)
Figure_6.add_trace(scat)
Figure_6.update_xaxes(title= 'Time (s)')
Figure_6.update_yaxes(title= 'Signal (V)')
Figure_6.update_layout(title = 'plotly Styling', template = 'plotly')
Figure_6.show(config = {'toImageButtonOptions': {'format': 'svg'}})
Figure 6: Example of plotly styling.
plotly_white¶
# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_7 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = LIF['time(s)'], y = LIF['Signal (V)'],
mode = 'lines', name = 'LIF 1',)
Figure_7.add_trace(scat)
Figure_7.update_xaxes(title= 'Time (s)')
Figure_7.update_yaxes(title= 'Signal (V)')
Figure_7.update_layout(title = 'plotly_white Styling', template = 'plotly_white')
Figure_7.show(config = {'toImageButtonOptions': {'format': 'svg'}})
Figure 7: Example of plotly_white styling.
plotly_dark¶
# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_8 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = LIF['time(s)'], y = LIF['Signal (V)'],
mode = 'lines', name = 'LIF 1',)
Figure_8.add_trace(scat)
Figure_8.update_xaxes(title= 'Time (s)')
Figure_8.update_yaxes(title= 'Signal (V)')
Figure_8.update_layout(title = 'plotly_dark Styling', template = 'plotly_dark')
Figure_8.show(config = {'toImageButtonOptions': {'format': 'svg'}})
Figure 8: Example of plotly_dark styling.
presentation¶
# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_9 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = LIF['time(s)'], y = LIF['Signal (V)'],
mode = 'lines', name = 'LIF 1',)
Figure_9.add_trace(scat)
Figure_9.update_xaxes(title= 'Time (s)')
Figure_9.update_yaxes(title= 'Signal (V)')
Figure_9.update_layout(title = 'presentation Styling', template = 'presentation')
Figure_9.show(config = {'toImageButtonOptions': {'format': 'svg'}})
Figure 9: Example of presentation styling.
xgridoff¶
# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_10 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = LIF['time(s)'], y = LIF['Signal (V)'],
mode = 'lines', name = 'LIF 1',)
Figure_10.add_trace(scat)
Figure_10.update_xaxes(title= 'Time (s)')
Figure_10.update_yaxes(title= 'Signal (V)')
Figure_10.update_layout(title = 'xgridoff Styling', template = 'xgridoff')
Figure_10.show(config = {'toImageButtonOptions': {'format': 'svg'}})
Figure 10: Example of xgridoff styling.
ygridoff¶
# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_11 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = LIF['time(s)'], y = LIF['Signal (V)'],
mode = 'lines', name = 'LIF 1',)
Figure_11.add_trace(scat)
Figure_11.update_xaxes(title= 'Time (s)')
Figure_11.update_yaxes(title= 'Signal (V)')
Figure_11.update_layout(title = 'ygridoff Styling', template = 'ygridoff')
Figure_11.show(config = {'toImageButtonOptions': {'format': 'svg'}})
Figure 11: Example of ygridoff styling.
gridon¶
# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_12 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = LIF['time(s)'], y = LIF['Signal (V)'],
mode = 'lines', name = 'LIF 1',)
Figure_12.add_trace(scat)
Figure_12.update_xaxes(title= 'Time (s)')
Figure_12.update_yaxes(title= 'Signal (V)')
Figure_12.update_layout(title = 'gridon Styling', template = 'gridon')
Figure_12.show(config = {'toImageButtonOptions': {'format': 'svg'}})
Figure 12: Example of gridon styling. Since it is not combined with another style it looks just like plotly_white.
simple_white+presentation¶
# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_13 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = LIF['time(s)'], y = LIF['Signal (V)'],
mode = 'lines', name = 'LIF 1',)
Figure_13.add_trace(scat)
Figure_13.update_xaxes(title= 'Time (s)')
Figure_13.update_yaxes(title= 'Signal (V)')
Figure_13.update_layout(title = 'simple_white+presentation Styling', template = 'simple_white+presentation')
Figure_13.show(config = {'toImageButtonOptions': {'format': 'svg'}})
Figure 13: Example of simple_white+presentation styling.
simple_white+gridon¶
# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_14 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = LIF['time(s)'], y = LIF['Signal (V)'],
mode = 'lines', name = 'LIF 1',)
Figure_14.add_trace(scat)
Figure_14.update_xaxes(title= 'Time (s)')
Figure_14.update_yaxes(title= 'Signal (V)')
Figure_14.update_layout(title = 'simple_white+gridon Styling', template = 'simple_white+gridon')
Figure_14.show(config = {'toImageButtonOptions': {'format': 'svg'}})
Figure 14: Example of simple_white+gridon styling. This is essentially the same as plotly_white.
simple_white+presentation+gridon¶
# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_15 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = LIF['time(s)'], y = LIF['Signal (V)'],
mode = 'lines', name = 'LIF 1',)
Figure_15.add_trace(scat)
Figure_15.update_xaxes(title= 'Time (s)')
Figure_15.update_yaxes(title= 'Signal (V)')
Figure_15.update_layout(title = 'simple_white+presentation+gridon Styling', template = 'simple_white+presentation+gridon')
Figure_15.show(config = {'toImageButtonOptions': {'format': 'svg'}})
Figure 15: Example of simple_white+presentation+gridon styling.
Learn More¶
In addition to trying it below if this is a live notebook, you can look at the other examples listed in the Pandas GUI website.
Try It¶
If you are running this notebook live in binder you can try it here by running the first cell to import the tools and data. Then run the cell below to create the GUI. Note: You may want to expand the collapsed instructions to learn more about each tab.
plot_pandas_GUI()