Skip to content

Commit

Permalink
Unlog y-axis (#371)
Browse files Browse the repository at this point in the history
* update cellsizedistribution plot axis
* switch plot numbers to improve readability
  • Loading branch information
Anugerah Erlaut authored and ivababukova committed Jul 19, 2021
1 parent b443dfb commit 5119b65
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const CellSizeDistribution = (props) => {
const plots = {
kneePlot: {
title: 'Knee Plot',
plotUuid: generateDataProcessingPlotUuid(sampleId, filterName, 1),
plotUuid: generateDataProcessingPlotUuid(sampleId, filterName, 0),
plotType: 'cellSizeDistributionKneePlot',
plot: (config, plotData, actions) => (
<CellSizeDistributionKneePlot
Expand All @@ -75,7 +75,7 @@ const CellSizeDistribution = (props) => {
},
histogram: {
title: 'Histogram',
plotUuid: generateDataProcessingPlotUuid(sampleId, filterName, 0),
plotUuid: generateDataProcessingPlotUuid(sampleId, filterName, 1),
plotType: 'cellSizeDistributionHistogram',
plot: (config, plotData, actions) => (
<CellSizeDistributionHistogram
Expand Down
2 changes: 1 addition & 1 deletion src/redux/reducers/componentConfig/initialState.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ const cellSizeDistributionKneePlot = {
axes: {
...axesBaseState,
xAxisText: 'Cell rank',
yAxisText: 'log #UMIs in cell',
yAxisText: '#UMIs in cell',
},
title: {
...titleBaseState,
Expand Down
26 changes: 14 additions & 12 deletions src/utils/plotSpecs/generateCellSizeDistributionKneePlot.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const generateSpec = (config, plotData) => {

const minCellSizeItem = _.findLast(
plotData,
(element) => element.log_u >= Math.log(config.minCellSize),
(element) => element.u >= config.minCellSize,
);

const minCellSizeRank = minCellSizeItem?.rank ?? 0;
Expand Down Expand Up @@ -65,7 +65,7 @@ const generateSpec = (config, plotData) => {
},
{
type: 'filter',
expr: 'datum.log_u > 0 && datum.rank > 0',
expr: 'datum.u > 0 && datum.rank > 0',
},
],
},
Expand Down Expand Up @@ -100,10 +100,10 @@ const generateSpec = (config, plotData) => {
},
{
name: 'yscale',
type: 'linear',
range: 'height',
type: 'log',
nice: true,
domain: { data: 'plotData', field: 'log_u' },
range: 'height',
domain: { data: 'plotData', field: 'u' },
},
{
name: 'color',
Expand All @@ -120,7 +120,7 @@ const generateSpec = (config, plotData) => {
tickCount: 5,
grid: true,
zindex: 1,
title: { value: config.axes.xAxisText },
title: config.axes.xAxisText,
titleFont: { value: config.fontStyle.font },
labelFont: { value: config.fontStyle.font },
titleFontSize: { value: config.axes.titleFontSize },
Expand All @@ -133,7 +133,7 @@ const generateSpec = (config, plotData) => {
scale: 'yscale',
grid: true,
zindex: 1,
title: { value: config.axes.yAxisText },
title: config.axes.yAxisText,
titleFont: { value: config.fontStyle.font },
labelFont: { value: config.fontStyle.font },
titleFontSize: { value: config.axes.titleFontSize },
Expand All @@ -147,23 +147,25 @@ const generateSpec = (config, plotData) => {
{
type: 'area',
from: { data: 'lowerHalfPlotData' },
clip: true,
encode: {
enter: {
x: { scale: 'xscale', field: 'rank' },
y: { scale: 'yscale', field: 'log_u' },
y2: { scale: 'yscale', value: 0 },
y: { scale: 'yscale', field: 'u' },
y2: { scale: 'yscale', value: 1 },
fill: { value: 'green' },
},
},
},
{
type: 'area',
from: { data: 'higherHalfPlotData' },
clip: true,
encode: {
enter: {
x: { scale: 'xscale', field: 'rank' },
y: { scale: 'yscale', field: 'log_u' },
y2: { scale: 'yscale', value: 0 },
y: { scale: 'yscale', field: 'u' },
y2: { scale: 'yscale', value: 1 },
fill: { value: '#f57b42' },
},
},
Expand All @@ -184,7 +186,7 @@ const generateSpec = (config, plotData) => {
],
legends: legend,
title: {
text: { value: config.title.text },
text: config.title.text,
anchor: { value: config.title.anchor },
font: { value: config.fontStyle.font },
dx: { value: config.title.dx },
Expand Down

0 comments on commit 5119b65

Please sign in to comment.