DnaFeaturesViewer icon indicating copy to clipboard operation
DnaFeaturesViewer copied to clipboard

To bold the base

Open Sameerpython opened this issue 4 years ago • 4 comments

Hi,

How to bold or increase the text size for the sequence position number graphic_record_defined_by_hand

Thanks!

Sameerpython avatar Jan 10 '21 20:01 Sameerpython

One quick way is to set the defaults before plotting:

import matplotlib as mpl
mpl.rc('xtick', labelsize=15)
mpl.rc('font', weight='bold')  # this, however, changes all text

Alternatively, if you save your figure, then you can modify it:

ax, _ = record.plot()
ax.set_xticklabels(ax.get_xticklabels(), fontdict={'weight':'bold'}, fontsize=20)
ax.figure

veghp avatar Jan 11 '21 13:01 veghp

Thanks veghp!!

Sameerpython avatar Jan 11 '21 16:01 Sameerpython

Hi Veghp,

How do i increase the fontsize of the feature label. for example: small feature, Gene1 with a very long name.

Thanks!

Sameerpython avatar Jan 11 '21 18:01 Sameerpython

Hi, not sure which is the best approach, but the options for changing the font size are

  1. using rc parameters as shown above (see matplotlib documentation or this question for details)
  2. change the font size in the GraphicFeature object's Matplotlib fontdict parameter
  3. change the matplotlib object (example)
  4. if you want something custom for publication, there is the option of saving into a file manually adjusting as mentioned in https://github.com/Edinburgh-Genome-Foundry/DnaFeaturesViewer/issues/45

veghp avatar Jan 12 '21 14:01 veghp