Edinburgh-Genome-Foundry / DnaFeaturesViewer

:eye: Python library to plot DNA sequence features (e.g. from Genbank files)
https://edinburgh-genome-foundry.github.io/DnaFeaturesViewer/
MIT License
584 stars 90 forks source link

To bold the base #52

Open Sameerpython opened 3 years ago

Sameerpython commented 3 years ago

Hi,

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

Thanks!

veghp commented 3 years ago

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
Sameerpython commented 3 years ago

Thanks veghp!!

Sameerpython commented 3 years ago

Hi Veghp,

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

Thanks!

veghp commented 3 years ago

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