Skip to content

Commit

Permalink
Initial multiple curves on reliability plot
Browse files Browse the repository at this point in the history
  • Loading branch information
mollybsmith-noaa committed Jul 25, 2023
1 parent e79fe0a commit 72e4fe5
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ const ReservedWords = {
perfectReliability: "Perfect Reliability",
perfectForecast: "Perfect Forecast",
noSkill: "No Skill",
noSkillNoLabel: "No Skill No Label",
constantBias: "Constant Bias",
constantCSI: "Constant CSI",
centerLine: "X=Y",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@
import { matsPlotUtils, matsCollections, matsTypes } from "meteor/randyp:mats-common";

// adds a horizontal black line along a specific y value
const getHorizontalValueLine = function (xmax, xmin, yValue, textPos, cLabel) {
const getHorizontalValueLine = function (
xmax,
xmin,
yValue,
textPos,
cLabel,
color,
weight
) {
const textLabel = yValue % 1 === 0 ? yValue.toString() : yValue.toFixed(2);

return {
Expand Down Expand Up @@ -34,8 +42,8 @@ const getHorizontalValueLine = function (xmax, xmin, yValue, textPos, cLabel) {
ymax: yValue,
line: {
dash: "solid",
color: "rgb(0,0,0)",
width: 1,
color,
width: weight,
},
marker: {
symbol: "circle",
Expand All @@ -46,7 +54,15 @@ const getHorizontalValueLine = function (xmax, xmin, yValue, textPos, cLabel) {
};

// adds a vertical black line along a specific x value
const getVerticalValueLine = function (ymax, ymin, xValue, textPos, cLabel) {
const getVerticalValueLine = function (
ymax,
ymin,
xValue,
textPos,
cLabel,
color,
weight
) {
const textLabel = xValue % 1 === 0 ? xValue.toString() : xValue.toFixed(2);

return {
Expand Down Expand Up @@ -74,8 +90,8 @@ const getVerticalValueLine = function (ymax, ymin, xValue, textPos, cLabel) {
ymax,
line: {
dash: "solid",
color: "rgb(0,0,0)",
width: 1,
color,
width: weight,
},
marker: {
symbol: "circle",
Expand All @@ -93,7 +109,9 @@ const getLinearValueLine = function (
ymin,
textLabel,
textPos,
cLabel
cLabel,
color,
weight
) {
return {
label: cLabel,
Expand All @@ -106,7 +124,11 @@ const getLinearValueLine = function (
y: [ymin, (ymin + ymax) / 2, ymax],
error_x: [null, null, null],
error_y: [null, null, null],
text: ["", textLabel, ""],
text: [
"",
textLabel === matsTypes.ReservedWords.noSkillNoLabel ? "" : textLabel,
"",
],
textposition: textPos,
subVals: [],
subSecs: [],
Expand All @@ -122,8 +144,8 @@ const getLinearValueLine = function (
ymax,
line: {
dash: "solid",
color: "rgb(0,0,0)",
width: 1,
color,
width: weight,
},
marker: {
symbol: "circle",
Expand All @@ -141,7 +163,9 @@ const getDashedLinearValueLine = function (
ymin,
textLabel,
textPos,
cLabel
cLabel,
color,
weight
) {
return {
label: cLabel,
Expand Down Expand Up @@ -169,8 +193,8 @@ const getDashedLinearValueLine = function (
ymax,
line: {
dash: "dot",
color: "rgb(0,0,0)",
width: 1,
color,
width: weight,
},
marker: {
symbol: "circle",
Expand All @@ -181,7 +205,16 @@ const getDashedLinearValueLine = function (
};

// adds a linear line
const getCurveLine = function (xvals, yvals, textVals, textLabel, textPos, cLabel) {
const getCurveLine = function (
xvals,
yvals,
textVals,
textLabel,
textPos,
cLabel,
color,
weight
) {
return {
label: cLabel,
curveId: cLabel,
Expand All @@ -207,8 +240,8 @@ const getCurveLine = function (xvals, yvals, textVals, textLabel, textPos, cLabe
ymax: Math.max(yvals),
line: {
dash: "solid",
color: "rgb(0,0,0)",
width: 1,
color,
width: weight,
},
marker: {
symbol: "circle",
Expand Down
Loading

0 comments on commit 72e4fe5

Please sign in to comment.