Skip to content

Commit d220a74

Browse files
committed
fix(fixedMarginsBugWhenSavingToPdf-NeededMoreMarignSpace):
1 parent 5f7e544 commit d220a74

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/plot_utils.jl

Lines changed: 9 additions & 8 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",
@@ -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]
@@ -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)