%load_ext autoreload
%autoreload 2
The autoreload extension is already loaded. To reload it, use: %reload_ext autoreload
from pytexshade import ipyshade
from plotnine import ggplot,geom_rect, geom_point, aes, stat_smooth,geom_bar, xlim, ylim, facet_wrap, theme_bw,theme_xkcd, geom_line, geom_tile
from plotnine import scale_y_continuous,scale_x_continuous, theme_bw,theme_classic, theme_dark, theme_light, theme_matplotlib, theme_minimal, theme_seaborn, theme_void
import plotnine as pn
from plotnine.data import mtcars
import pandas as pd
import numpy as np
from seqplot import p9tools
from seqplot.p9tools import geom_seq_x
shaded=ipyshade.shadepdbquick(pdb_chain_id='1KX5_A',feature_types=['SecStr'],force_feature_pos='bottom',ruler='bottom',legend=False,show_seq_names=False,show_seq_length=False)
shaded
df=pd.DataFrame({'x':np.arange(1,136),'value':np.abs(np.sin(np.arange(1,136)/10.))})
g=(ggplot(data=df,mapping=aes(x='x', y='value'))
+ geom_point(size=0.1)+geom_bar(stat='identity')
+ scale_x_continuous(limits=(0.5,135.5),expand=(0,0),name='',breaks=[])
+ scale_y_continuous(breaks=[0,0.5,1.0])
+ theme_light()+pn.theme(aspect_ratio=0.15,dpi=300,plot_margin=0))
g
<ggplot: (-9223363291796814869)>
gseq = g + geom_seq_x(seqimg=shaded.img,x=df.x,y=df.value,aspect_ratio=0.15)
gseq
<ggplot: (8745059560498)>
gseq.save('plot.png')
/opt/miniconda3/envs/moldyn/lib/python3.7/site-packages/plotnine/ggplot.py:729: PlotnineWarning: Saving 6.4 x 4.8 in image. from_inches(height, units), units), PlotnineWarning) /opt/miniconda3/envs/moldyn/lib/python3.7/site-packages/plotnine/ggplot.py:730: PlotnineWarning: Filename: plot.png warn('Filename: {}'.format(filename), PlotnineWarning)