Skip to content

Commit e902339

Browse files
authored
Merge pull request #77 from compbiocore/develop
fix(FixedLabellingOfTrait1AndTrait2.ColorsWereReversedInLegend.):
2 parents 8e8811b + d220a74 commit e902339

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "VariantVisualization"
22
uuid = "7f8bf45c-0ad5-53b5-97e6-33c1305e0aa4"
33
authors = ["George Tollefson <gatollefson@gmail.com>"]
4-
version = "0.4.1"
4+
version = "0.4.2"
55

66
[deps]
77
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"

src/plot_utils.jl

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function genotype_heatmap2_new_legend(input,title,chrom_label_info,sample_names,
3333
ticktext = ["No Call (0)", "Homozygous Reference", "Heterozygous Variant", "Homozygous Variant"])
3434
);
3535

36-
#we define a custom legend using shapes and a text scatter trace
36+
#we define a custom legend using shapes and a text scatter trace #x_axis_text_anchor+extra_right_margin_space
3737
trace2 = scatter(
3838
;x=[x_axis_text_anchor,x_axis_text_anchor,x_axis_text_anchor,x_axis_text_anchor,x_axis_text_anchor+extra_right_margin_space], y=y=[position_1+text_point_increment,position_3+text_point_increment,position_5+text_point_increment,position_7+text_point_increment,position_9+text_point_increment],
3939
mode="text", name="legend label",
@@ -120,8 +120,8 @@ function genotype_heatmap_with_groups(input::Array{Int64,2},title::String,chrom_
120120
transpose=true,
121121

122122
colorscale = [
123-
[0, "rgb(208, 211, 212)"], #light grey
124-
[0.2, "rgb(151, 154, 154)"], #dark grey
123+
[0, "rgb(151, 154, 154)"], #dark grey
124+
[0.2, "rgb(208, 211, 212)"], #light grey
125125
[0.4, "rgb(255,255,255)"], #white
126126
#[0.4, "rgb(56,25,90)"], #dark blue
127127
[0.6, "rgb(51,106,145)"], #blue
@@ -136,20 +136,21 @@ function genotype_heatmap_with_groups(input::Array{Int64,2},title::String,chrom_
136136
);
137137

138138
#we define a custom legend using shapes and a text scatter trace
139+
139140
trace2 = scatter(
140141
;x=[x_axis_text_anchor,x_axis_text_anchor,x_axis_text_anchor,x_axis_text_anchor,x_axis_text_anchor+extra_right_margin_space,x_axis_text_anchor,x_axis_text_anchor], y=y=[position_1+text_point_increment,position_2+text_point_increment,position_3+text_point_increment,position_4+text_point_increment,position_5+text_point_increment,position_7+text_point_increment,position_8+text_point_increment],
141142
mode="text", name="legend label",
142143
textposition="middle right",
143-
text=["No Call", "Homozygous Reference", "Heterozygous Variant", "Homozygous Variant","", "Trait 2","Trait 1"],
144+
text=["No Call", "Homozygous Reference", "Heterozygous Variant", "Homozygous Variant"," ", "Trait 2","Trait 1"],
144145
marker_size=300, textfont_family="Raleway, sans-serif")
145146

146147
shapes = [
147148
rect(x0=legend_xaxis_anchor, y0=position_4, x1=legend_xaxis_anchor_2, y1=position_5, opacity=1.0, fillcolor="rgb(251,231,65)", line_color="black"),
148149
rect(x0=legend_xaxis_anchor, y0=position_3, x1=legend_xaxis_anchor_2, y1=position_4, opacity=1.0, fillcolor="rgb(65,165,137)", line_color="black"),
149150
rect(x0=legend_xaxis_anchor, y0= position_2, x1=legend_xaxis_anchor_2, y1=position_3, opacity=1.0, fillcolor="rgb(51,106,145)", line_color="black"),
150151
rect(x0=legend_xaxis_anchor, y0= position_1, x1=legend_xaxis_anchor_2, y1=position_2, opacity=1.0, fillcolor="rgb(255,255,255)", line_color="black"),
151-
rect(x0=legend_xaxis_anchor, y0= position_7, x1=legend_xaxis_anchor_2, y1=position_8, opacity=1.0, fillcolor="rgb(151, 154, 154)", line_color="black"),
152-
rect(x0=legend_xaxis_anchor, y0= position_8, x1=legend_xaxis_anchor_2, y1=position_9, opacity=1.0, fillcolor="rgb(208, 211, 212)", line_color="black")
152+
rect(x0=legend_xaxis_anchor, y0= position_7, x1=legend_xaxis_anchor_2, y1=position_8, opacity=1.0, fillcolor="rgb(208, 211, 212)", line_color="black"),
153+
rect(x0=legend_xaxis_anchor, y0= position_8, x1=legend_xaxis_anchor_2, y1=position_9, opacity=1.0, fillcolor="rgb(151, 154, 154)", line_color="black")
153154
]
154155

155156
data = [trace, trace2]
@@ -351,8 +352,8 @@ function dp_heatmap2_with_groups(input::Array{Int64,2},title::String,chrom_label
351352
transpose=true,
352353

353354
colorscale = [
354-
[0, "rgb(208, 211, 212)"], #light grey
355-
[0.125, "rgb(151, 154, 154)"], #dark grey
355+
[0, "rgb(151, 154, 154)"], #dark grey
356+
[0.125, "rgb(208, 211, 212)"], #light grey
356357
[0.25, "rgb(255, 255, 255)"],
357358
[0.4, "rgb(153,231,255)"],
358359
[0.5, "rgb(79,146,255)"],
@@ -380,8 +381,8 @@ function dp_heatmap2_with_groups(input::Array{Int64,2},title::String,chrom_label
380381
data = [trace, trace2]
381382

382383
shapes = [
383-
rect(x0=legend_xaxis_anchor, y0= position_7, x1=legend_xaxis_anchor_2, y1=position_8, opacity=1.0, fillcolor="rgb(151, 154, 154)", line_color="black"),
384-
rect(x0=legend_xaxis_anchor, y0= position_8, x1=legend_xaxis_anchor_2, y1=position_9, opacity=1.0, fillcolor="rgb(208, 211, 212)", line_color="black"),
384+
rect(x0=legend_xaxis_anchor, y0= position_7, x1=legend_xaxis_anchor_2, y1=position_8, opacity=1.0, fillcolor="rgb(208, 211, 212)", line_color="black"),
385+
rect(x0=legend_xaxis_anchor, y0= position_8, x1=legend_xaxis_anchor_2, y1=position_9, opacity=1.0, fillcolor="rgb(151, 154, 154)", line_color="black"),
385386
rect(x0=legend_xaxis_anchor, y0=position_5, x1=legend_xaxis_anchor_2, y1=position_6, opacity=1.0, fillcolor="rgb(37,114,242)", line_color="black"),
386387
rect(x0=legend_xaxis_anchor, y0=position_4, x1=legend_xaxis_anchor_2, y1=position_5, opacity=1.0, fillcolor="rgb(67,138,254)", line_color="black"),
387388
rect(x0=legend_xaxis_anchor, y0=position_3, x1=legend_xaxis_anchor_2, y1=position_4, opacity=1.0, fillcolor="rgb(110,182,255)", line_color="black"),
@@ -579,7 +580,7 @@ function generate_legend_increments_ungrouped(input)
579580
legend_xaxis_anchor = number_samples + distance_from_plot_edge
580581
legend_xaxis_anchor_2 = legend_xaxis_anchor + width_of_color_box
581582
x_axis_text_anchor = legend_xaxis_anchor_2 + number_samples/40
582-
extra_right_margin_space=number_samples/5
583+
extra_right_margin_space=number_samples/4
583584
extra_right_margin_space_dp = number_samples/10
584585

585586
position_1 = number_rows/2
@@ -613,7 +614,7 @@ function generate_legend_increments_grouped(input)
613614
legend_xaxis_anchor = number_samples + distance_from_plot_edge
614615
legend_xaxis_anchor_2 = legend_xaxis_anchor + width_of_color_box
615616
x_axis_text_anchor = legend_xaxis_anchor_2 + number_samples/40
616-
extra_right_margin_space = number_samples/5
617+
extra_right_margin_space = number_samples/3
617618

618619

619620
position_1 = number_rows/3

0 commit comments

Comments
 (0)