Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unlog y-axis #371

Merged
merged 2 commits into from
Jun 30, 2021
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
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),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plot index is switched so that it's arranged according to the order

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',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed from log_u to u. The value is also changed from the pipeline.

},
],
},
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,
Copy link
Contributor Author

@aerlaut aerlaut Jun 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be a non-breaking API change for Vega. As seen from this document: https://vega.github.io/vega/docs/title/ the text field requires String, but we can still use the value inside the object. We might need some clean-up and refactors updates for the plots.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed this too, it would be a nice clean-up to make.

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