brennanpincardiff / drawProteins

Creating package to draw proteins from Uniprot API
Other
33 stars 17 forks source link

use y-axis labels to label proteins #16

Open daniel-wells opened 4 years ago

daniel-wells commented 4 years ago

Using annotate for chain labels sometimes clips the start of the label.

I changed to instead use the breaks and labels argument in scale_y_continuous which automatically handles resizing things such that the label is always readable.

You could of course use + xlim(-200,NA) but you have to manually set the minimum value and you get a random "-200" on the x-axis label which is in the middle of nowhere if you have a plain background. It seems simpler to use the machinary for axis labels which is already built into ggplot, given these chain labels are in effect axis labels? This also fixes a bug in that proteins with multiple chains have bold labels compared to the others due to ploting the label for each chain.

Example showing probelm:

library(drawProteins)
rel_json <- drawProteins::get_features("Q9UGP5 Q9FNY4 Q9QXE2 Q67VC8 P07683")
#> [1] "Download has worked"
rel_data <- drawProteins::feature_to_dataframe(rel_json)
p <- draw_canvas(rel_data)
p <- draw_chains(p, rel_data)
p <- draw_domains(p, rel_data)
p

Created on 2019-08-19 by the reprex package (v0.3.0)