gosling.js
gosling.js copied to clipboard
how does one simply draw a horizontal line across the whole plot?
I want to use the rule mark to draw a horizontal line across the whole x-axis and at 2.5 in the y-axis. I don't know how I can do that.
This question has been also asked on BioStars (https://www.biostars.org/tag/gosling.js/).
By the way, I also want to know how I can draw vertical lines.
Hi @zhangzhen,
Apologize that my answer was delayed and thank you for asking the question on BioStars as well.
The horizontal line that spans the entire track is not currently supported, but let me think about how to support this in our grammar.
Regarding the vertical lines, do you want to draw vertical lines with a static stroke width (e.g., 1px
) at given genomic position?
The horizontal line that spans the entire track is not currently supported, but let me think about how to support this in our grammar.
The rule mark of genomespy may be an example you can reference.
Regarding the vertical lines, do you want to draw vertical lines with a static stroke width (e.g.,
1px
) at given genomic position?
Yes, this is what I want.
Regarding the vertical lines, do you want to draw vertical lines with a static stroke width (e.g.,
1px
) at given genomic position?
Any progress on this?
Zhen
Thank you for reminding me of this. I am thinking of the following grammatical support for both horizontal and vertical lines.
Vertical line:
{ data: {
type: 'json',
values: [{ c: 'chr1', p: 1000 }],
chromosomeField: 'c',
genomicFields: ['p']
},
mark: 'rule',
x: { field: 'p', type: 'genomic' }, ...
}
Horizontal line:
{ data: {
type: 'json',
values: [{ c: 'chr1', p: 1000, v: 0.5 }],
chromosomeField: 'c',
genomicFields: ['p']
},
mark: 'rule',
y: { field: 'v', type: 'quantitative' }, ...
}
Dotted lines can be supported by child properties of track.style
.
Thank you for reminding me of this. I am thinking of the following grammatical support for both horizontal and vertical lines.
Awesome! When do you plan to release a new version containing this?
Zhen
@zhangzhen, the rules should work in linear layouts, as of #601. Refer to the following example on the editor
https://gosling.js.org/?example=RULE
@zhangzhen, the rules should work in linear layouts, as of #601.
Awesome! Thank you very much!