Data Visualization#
Tools for plotting data.
lsst.cst data science plot display utilities. Next modules are available: - displays: Display available for data plotting. - options: Options for data displaying.
- class lsst.cst.data_visualization.DataImageDisplay(data)#
Scatter plots and figures creation management.
- Parameters:
data (
DataWrapper) – Data used to create plots.
- create_axe(data_identifier, label=None, range=None, unit='N/A')#
Create Axe information to be used on scatter plots.
- Parameters:
- Returns:
axe_information – Axe information to be used in a scatter plot.
- Return type:
hv.Dimension
- create_figure(identifier, options=FigureOptions(height=600, tools=['pan,box_zoom,box_select,lasso_select,reset,help'], width=700, xlabel='X', ylabel='Y'))#
Creates a new figure and save the reference for future use.
- Parameters:
identifier (
str) – Figure identifier, used to use it as figure reference.figure_options (
FigureOptions, optional) – Created figure options.options (
FigureOptions, default:FigureOptions(height=600, tools=['pan,box_zoom,box_select,lasso_select,reset,help'], width=700, xlabel='X', ylabel='Y')) –
- Returns:
figure – Data figure instance class.
- Return type:
DataFigure- Raises:
AssertionError – Identifier already taken by another figure.:
- get_figure(figure_identifier)#
- Returns previously created figure
identified by the figure_identifier.
- Parameters:
figure_identifier (
str) – Unique identifier for a figure.- Returns:
figure – Figure identified by figure_identifier string.
- Return type:
DataFigure- Raises:
AssertionError – Figure id is not found:
- show(layout, tools_position='above')#
Show selected figures already created and configured.
- show_data_shade(columns=None, options=DataShadeOptions(cmap='Viridis', fontsize={'title': 16, 'xlabel': 14, 'ylabel': 14, 'ticks': 12}, height=600, padding=0.05, show_grid=True, xlabel='X', xlim=None, ylabel='Y', ylim=None, tools=[], width=700))#
Creates datashader plot using selected columns from data.
- Parameters:
columns (
Tuple[hv.Dimension | str, hv.Dimension | str], optional) – Data columns selected to create the datashader plot, if non columns are passed the two first columns from data will be used.options (DataShadeOptions, optional) – Scatter plot options.
- Returns:
plot – Datashader plot.
- Return type:
- show_histogram(field, options=HistogramOptions(color='darkorange', fontscale=1.2, height=600, title='No title', xlabel='X', width=700, ylabel='Y'))#
Creates histogram plot using selected columns from data.
- Parameters:
field (
str) – Data column selected to create the histogram plot.options (HistogramOptions, optional) – Histogram plot options.
- Returns:
plot – Histogram plot.
- Return type:
hv.Histogram
- show_scatter(columns=None, options=HVScatterOptions(alpha=1.0, color='darkorange', fontsize={'title': 16, 'xlabel': 14, 'ylabel': 14, 'ticks': 12}, height=600, invert_xaxis=False, invert_yaxis=False, marker='circle', size=5, title=None, toolbar_position='above', tools=[], width=700, xlabel='X', ylabel='Y'))#
Creates scatter plot using selected columns from data.
- Parameters:
columns (
Tuple[hv.Dimension | str, hv.Dimension | str], optional) – Data columns to create the scatter plot, if non columns are passed the two first columns from data will be used.options (ScatterOptions, optional) – Scatter plot options.
- Returns:
plot – Scatter plot.
- Return type:
hv.Scatter
- class lsst.cst.data_visualization.DataShadeOptions(cmap='Viridis', fontsize=<factory>, height=600, padding=0.05, show_grid=True, xlabel='X', xlim=None, ylabel='Y', ylim=None, tools=<factory>, width=700)#
Datashade options
- Parameters:
cmap (
str, optional) – color mapping to be applied to the Datashader plot.fontsize (dict[str, str], optional) – Size of the diferent elements in the plot: title, xlabel, ylabel, ticks.
height (
int, optional) – Height of the plot in pixels.padding (
float, optional) – Extra space is added around the data points in the plot.show_grid (
bool, optional) – Show plot grid.xlabel (
str, optional) – xlabel value.xlim (
Tuple[float, float], optional) – X axes limits.ylabel (
str, optional) – ylabel value.ylim (
Tuple[float, float], optional) – Y axes limits.tools (List = field(default_factory=list)) – Plot tools available.
width (
int, optional) – Width of the plot in pixels.
- class lsst.cst.data_visualization.FigureOptions(height=600, tools=<factory>, width=700, xlabel='X', ylabel='Y')#
Figure plot options.
- Parameters:
- class lsst.cst.data_visualization.GeometricPlots#
Static functions to create HV plots with geometric figures.
- static points(points, options=PointsOptions(alpha=1.0, color='darkorange', fontsize={'title': 16, 'xlabel': 14, 'ylabel': 14, 'ticks': 12}, height=600, size=5, title=None, width=700, xlabel=None, ylabel=None))#
Create a plot with the selected points on it.
- Parameters:
points (
List[Tuple[float, float]]) – Points to be plot.options (
PointsOptions) – Points plot options.
- Returns:
plot – Plot with the points draw on it.
- Return type:
hv.Points
- static polygons(region_data, kdims=None, vdims=None, tooltips=None, options=PolygonOptions(alpha=0.0, cmap=None, color=None, height=600, tools=None, hover_alpha=0.3, line_color='blue', line_alpha=1.0, title=None, width=700, xlabel=None, ylabel=None))#
Create a plot with the selected polygons on it.
- Parameters:
polygon_information (
list[PolygonInformation]) – Polygon information, including the vertex and other data to be shown.kdims (
Optional[Tuple[str, str]]) – X and Y vertex points values.vdims (
Optional[Tuple[str, str]]) – Other column information to be shown.tooltipls (
Optional[List[Tuple[str, str]]]) – On hoover text information.options (
PointsOptions) – Polygon plot options.region_data (
list[PolygonInformation]) –
- Returns:
plot – Plot with the polygons draw on it.
- Return type:
hv.Points
- class lsst.cst.data_visualization.HVScatterOptions(alpha=1.0, color='darkorange', fontsize=<factory>, height=600, invert_xaxis=False, invert_yaxis=False, marker='circle', size=5, title=None, toolbar_position='above', tools=<factory>, width=700, xlabel='X', ylabel='Y')#
Holoviews Scatter Options.
- Parameters:
alpha (
float, optional) – Plot points alpha value.color (
str,optional) – Plot points color.fontsize (dict, optional) – dictionary selecting fontsize for different elements on the plot.
invert_xaxis (
bool, optional) – Invert xaxis of the plot.invert_yaxis (bool = False) – Invert xaxis of the plot.
height (
int, optional) – Height of the plot in pixels.marker (
str, optional) – Plot points marker type.size (int, optional) – Plot points marker type.
toolbar (
str, optional) – Toolbar position.tools (
List, optional) – Plot tools available.width (
int, optional) – Width of the plot in pixels.xlabel (str, optional) – xlabel value.
ylabel (
str) – ylabel value.toolbar_position (
str, default:'above') –
- class lsst.cst.data_visualization.HistogramOptions(color='darkorange', fontscale=1.2, height=600, title='No title', xlabel='X', width=700, ylabel='Y')#
Plot histogram options
- Parameters:
color (
str, optional) – Histogram bars color.fontscale (
float, optional) – Histogram labels fontsize.height (
int, optional) – Height of the plot in pixels.title (str, optional) – Plot title.
xlabel (
str, optional) – xlabel value.width (
int, optional) – Width of the plot in pixels.ylabel (
str, optional) – ylabel value.
- class lsst.cst.data_visualization.PointsOptions(alpha=1.0, color='darkorange', fontsize=<factory>, height=600, size=5, title=None, width=700, xlabel=None, ylabel=None)#
Points plot options.
- Parameters:
alpha (
float, optional) – Plot points alpha value.color (
str, optional) – Plot points color.fontsize (dict[str, str], optional) – Size of the diferent elements in the plot: title, xlabel, ylabel, ticks.
height (
int, optional) – Height of the plot in pixels.size (int, optional) – Points marker size.
title (str, optional) – Plot title.
width (
int, optional) – Width of the plot in pixels.xlabel (str, optional) – xlabel value.
ylabel (
str) – ylabel value.
- class lsst.cst.data_visualization.PolygonOptions(alpha=0.0, cmap=None, color=None, height=600, tools=None, hover_alpha=0.3, line_color='blue', line_alpha=1.0, title=None, width=700, xlabel=None, ylabel=None)#
Polygon plot options.
- Parameters:
alpha (
float, optional) – Polygons alpha value.cmap (
dict[str, str], optional) – Color map.color (
str) – Polygon fill color.height (
int, optional) – Height of the plot in pixels.tools (
List, optional) – Plot tools available.hover_alpha (
float, optional) – Polygon alpha value on hover.line_color (
List, optional) – Polygon line color.line_alpha (
List, optional) – Polygon line alpha value.title (str, optional) – Plot title.
width (
int, optional) – Width of the plot in pixels.xlabel (str, optional) – xlabel value.
ylabel (
str) – ylabel value.
- class lsst.cst.data_visualization.ScatterOptions(alpha=1.0, color='darkorange', marker='circle', size=5)#
Bokeh Scatter plot options.
- Parameters:
- lsst.cst.data_visualization.create_polygons_and_point_plot(df, points)#
Draw list of boxes in a dataframe and list of points.
- Parameters:
- Returns:
plot – Panel Row containing the polygons and points.
- Return type:
pn.Row