Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
kchu25 committed Sep 16, 2024
1 parent 3a85822 commit 04a7105
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ The `background` is an array representing the background probabilities for A, C,
You can also call:
```
logoplot(pfm)
logoplot(pfm; uniform_color=true)
```
to get the same results as above, where the background is set to `[0.25, 0.25, 0.25, 0.25]` by default.

Expand Down
12 changes: 7 additions & 5 deletions src/plot_logo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ end
setup_off=false,
alpha=1.0,
beta=1.0,
dpi=65
dpi=65,
uniform_color=false
)
if !setup_off
num_cols = size(data.args[1], 2)
@info "num_cols: $num_cols"
xticks --> 1:1:num_cols # xticks needs to be placed here to avoid fractional xticks? weird
@info "num_cols: $num_cols"
ylims --> (0, ylim_max)
xlims --> (xlim_min, num_cols+1)
logo_size = (_width_factor_(num_cols)*num_cols, logo_height)
Expand All @@ -69,12 +70,12 @@ end
legend --> false
tickdir --> :out
grid --> false
dtick--> 10
margin --> margin
thickness_scaling --> thickness_scaling
size --> logo_size
framestyle --> :zerolines
# framestyle --> :box
end
xticks --> 1:1:size(data.args[1], 2) # xticks needs to be placed here to avoid fractional xticks? weird
dpi --> dpi
alpha --> alpha
pfm = data.args[1]
Expand All @@ -84,11 +85,12 @@ end
logo_y_offset=logo_y_offset);
# @info "coords: $(typeof(coords[1]))"
for (k, v) in coords
color_here = uniform_color ? "#4664CB" : get(AA_PALETTE3, k, :grey)
@series begin
fill := 0
lw --> 0
label --> k
color --> get(AA_PALETTE3, k, :grey)
color --> color_here
v.xs, v.ys
end
end
Expand Down
6 changes: 4 additions & 2 deletions src/plot_logo_w_arr_gaps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ function logoplot_with_arrow_gaps(pfms,
weights::AbstractVector;
given_num_cols::Int=15,
arrow_shape_scale_ratio::Real=0.7,
height_top::Real=1.7
height_top::Real=1.7,
uniform_color=true,
)

@assert length(pfms)-1 == size(ds_mats, 2) "The number of columns in ds_mats should be equal to the length of pfms - 1"
Expand All @@ -57,7 +58,8 @@ function logoplot_with_arrow_gaps(pfms,
logoplot!(p, pfm, PlotPWM.bg;
dpi=65,
setup_off=true,
logo_x_offset=logo_x_offset)
logo_x_offset=logo_x_offset,
uniform_color=uniform_color)
end

for (ind, col) in enumerate(eachcol(coords_mat))
Expand Down
2 changes: 1 addition & 1 deletion src/plot_nothing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
margin --> margin
thickness_scaling --> thickness_scaling
size --> logo_size
framestyle --> :zerolines
framestyle --> :none
dpi --> dpi
end
end
Binary file added test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tmp3.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ weights = [0.3, 0.2, 0.3, 0.2]
ds_mats = [12 6; 32 6; 235 14]
weights = [0.5, 0.2, 0.3]


using Plots
p = logoplot_with_arrow_gaps(pfms, ds_mats, weights)


savefig(p, "test.png")



Expand Down

0 comments on commit 04a7105

Please sign in to comment.