-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Hello! Thank you for the very useful tool! I was plotting bootstrap data on my phylogenetic tree as points on nodes color-coded with a continuous gradient. Here is the code to produce this:
static Gradient gradient = new Gradient(
new List<TreeViewer.GradientStop>()
{
new TreeViewer.GradientStop(0, Colour.FromRgba(0.996078431372549d, 0.2901960784313726d, 0.28627450980392155d, 1d)),
new TreeViewer.GradientStop(0.5, Colour.FromRgba(0.996078431372549d, 0.8431372549019608d, 0.4d, 1d)),
new TreeViewer.GradientStop(1, Colour.FromRgba(0d, 0.6235294117647059d, 0.7176470588235294d, 1d))
});
public static Colour? Format(object attribute)
{
if (attribute is double attributeValue &&
!double.IsNaN(attributeValue))
{
double position = (attributeValue - 0) / 100;
position = Math.Max(Math.Min(position, 1), 0);
return gradient.GetColour(position);
}
else
{
return null;
}
}
On the manual, you show how to create a legend using binned categories, and that works fine. Though, I was wondering if you know of any way in which I can create an actual gradient also in the legend. Something like this:
Thank you very much for helping!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels