Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed core/gui/src/assets/operator_images/BoxPlot.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ import edu.uci.ics.amber.operator.visualization.IcicleChart.IcicleChartOpDesc
import edu.uci.ics.amber.operator.visualization.ImageViz.ImageVisualizerOpDesc
import edu.uci.ics.amber.operator.visualization.ScatterMatrixChart.ScatterMatrixChartOpDesc
import edu.uci.ics.amber.operator.visualization.barChart.BarChartOpDesc
import edu.uci.ics.amber.operator.visualization.boxPlot.BoxPlotOpDesc
import edu.uci.ics.amber.operator.visualization.boxViolinPlot.BoxViolinPlotOpDesc
import edu.uci.ics.amber.operator.visualization.bubbleChart.BubbleChartOpDesc
import edu.uci.ics.amber.operator.visualization.candlestickChart.CandlestickChartOpDesc
import edu.uci.ics.amber.operator.visualization.continuousErrorBands.ContinuousErrorBandsOpDesc
Expand Down Expand Up @@ -186,7 +186,7 @@ trait StateTransferFunc
new Type(value = classOf[HierarchyChartOpDesc], name = "HierarchyChart"),
new Type(value = classOf[DumbbellPlotOpDesc], name = "DumbbellPlot"),
new Type(value = classOf[DummyOpDesc], name = "Dummy"),
new Type(value = classOf[BoxPlotOpDesc], name = "BoxPlot"),
new Type(value = classOf[BoxViolinPlotOpDesc], name = "BoxViolinPlot"),
new Type(value = classOf[NetworkGraphOpDesc], name = "NetworkGraph"),
new Type(value = classOf[HistogramChartOpDesc], name = "Histogram"),
new Type(value = classOf[ScatterMatrixChartOpDesc], name = "ScatterMatrixChart"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package edu.uci.ics.amber.operator.visualization.boxPlot;
package edu.uci.ics.amber.operator.visualization.boxViolinPlot;

import com.fasterxml.jackson.annotation.JsonValue;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package edu.uci.ics.amber.operator.visualization.boxPlot
package edu.uci.ics.amber.operator.visualization.boxViolinPlot

import com.fasterxml.jackson.annotation.{JsonProperty, JsonPropertyDescription}
import com.kjetland.jackson.jsonSchema.annotations.{JsonSchemaInject, JsonSchemaTitle}
Expand All @@ -17,7 +17,7 @@ import edu.uci.ics.amber.operator.PythonOperatorDescriptor
}
}
""")
class BoxPlotOpDesc extends PythonOperatorDescriptor {
class BoxViolinPlotOpDesc extends PythonOperatorDescriptor {

@JsonProperty(value = "value", required = true)
@JsonSchemaTitle("Value Column")
Expand All @@ -30,6 +30,11 @@ class BoxPlotOpDesc extends PythonOperatorDescriptor {
@JsonPropertyDescription("Orientation Style")
var orientation: Boolean = _

@JsonProperty(defaultValue = "false")
@JsonSchemaTitle("Violin Plot")
@JsonPropertyDescription("Use Violin Plot")
var violinplot: Boolean = _

@JsonProperty(
value = "Quartile Method",
required = true,
Expand All @@ -48,8 +53,8 @@ class BoxPlotOpDesc extends PythonOperatorDescriptor {

override def operatorInfo: OperatorInfo =
OperatorInfo(
"Box Plot",
"Visualize data in a Box Plot. Boxplots are drawn as a box with a vertical line down the middle which is mean value, and has horizontal lines attached to each side (known as “whiskers”).",
"Box/Violin Plot",
"Visualize data using either a Box Plot or a Violin Plot. Boxplots are drawn as a box with a vertical line down the middle which is mean value, and has horizontal lines attached to each side (known as “whiskers”). Violin plots are similar to box plots, but with a rotated kernel density plot on each side, providing more insight into the distribution shape.",
OperatorGroupConstants.VISUALIZATION_GROUP,
inputPorts = List(InputPort()),
outputPorts = List(OutputPort(mode = OutputMode.SINGLE_SNAPSHOT))
Expand All @@ -65,14 +70,21 @@ class BoxPlotOpDesc extends PythonOperatorDescriptor {
}

def createPlotlyFigure(): String = {
var horizontal = ""
if (orientation) horizontal = "True"
val horizontal = if (orientation) "True" else "False"
val violin = if (violinplot) "True" else "False"
s"""
| if($horizontal):
| fig = px.box(table, x='$value',boxmode="overlay", points='all')
| if($violin):
| if ($horizontal):
| fig = px.violin(table, x='$value', box=True, points='all')
| else:
| fig = px.violin(table, y='$value', box=True, points='all')
| else:
| fig = px.box(table, y='$value',boxmode="overlay", points='all')
| fig.update_traces(quartilemethod="${quertiletype.getQuartiletype}", jitter=0, col=1)
| if($horizontal):
| fig = px.box(table, x='$value',boxmode="overlay", points='all')
| else:
| fig = px.box(table, y='$value',boxmode="overlay", points='all')
| fig.update_traces(quartilemethod="${quertiletype.getQuartiletype}", jitter=0, col=1)
|
| fig.update_layout(margin=dict(t=0, b=0, l=0, r=0))
|""".stripMargin
}
Expand All @@ -95,7 +107,7 @@ class BoxPlotOpDesc extends PythonOperatorDescriptor {
|
| # Generate custom error message as html string
| def render_error(self, error_msg) -> str:
| return '''<h1>Box Plot is not available.</h1>
| return '''<h1>Box/Violin Plot is not available.</h1>
| <p>Reason is: {} </p>
| '''.format(error_msg)
|
Expand Down
Loading