# Multiple X Axis Line chart using R (subplot)

**URL:** <https://community.plotly.com/t/multiple-x-axis-line-chart-using-r-subplot/2394>\
**Category:** Plotly R\
**Created:** [October 12, 2016, 10:23pm UTC](https://community.plotly.com/t/multiple-x-axis-line-chart-using-r-subplot/2394 "2016-10-12T22:23:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![balexbyrd](https://avatars.discourse-cdn.com/v4/letter/b/e19adc/32.png) [@balexbyrd](https://community.plotly.com/u/balexbyrd)\
**Post date:** [October 12, 2016, 10:23pm UTC](https://community.plotly.com/t/multiple-x-axis-line-chart-using-r-subplot/2394/1 "2016-10-12T22:23:47Z")

</div>

Hi there!

I’m trying to create a multiple X axis line chart. Code snippet below

> p1 ← plot\_ly(M, x=interaction(`M`[[4]],`M`[[3]]), y=M[[5]], color= M[[1]], colors=“Accent”, mode = “markers+lines”)  
> p2 ← plot\_ly(F, x=interaction(`F`[[4]],`F`[[3]]), y=F[[5]], color=F[[1]], colors=“Set3”, mode = “markers+lines”)  
> p3 ← subplot(p1,p2, nrows =2, shareX=FALSE,shareY=FALSE, margin=0.05) %\>% layout(  
> autosize = TRUE,  
> showlegend = FALSE,  
> font = list(family=“Arial”,size=9,color=“gray”),  
> xaxis= list(title=“M”, titlefont = list(size=10),zeroline = FALSE,showgrid = FALSE, type = “category”, categoryorder=“category ascending”)  
> xaxis2= list(title=“F”, titlefont = list(size=10),zeroline = FALSE,showgrid = FALSE, type = “category”, categoryorder=“category ascending”),  
> yaxis = list(showticklabels=TRUE, autorange = TRUE, title=“Y1”, ticks=“inside”, zeroline=FALSE),  
> yaxis2 = list(showticklabels=TRUE, autorange = TRUE, title=“Y2”, ticks=“inside”, zeroline=FALSE) ,  
> paper\_bgcolor = “#fff”,  
> margin=list(l=35,r=10,b=30,t=20)  
> )  
> P ← plotly\_POST(p3,filename = “Line”, fileopt = “overwrite”);  
> url ← P$url

Each axis looks like  
 ![](https://us1.discourse-cdn.com/flex024/uploads/plot/original/1X/f42156b88af35f8e7f1f435a689afad52d9b69ab.PNG)

I have two issues:

1. How do I have 1 distinct Screening / Visit value show up on the axis?
2. If I can’t have 1, then how would I go about removing the dot (.) between the visit and the number?

I know it’s due to the x=interaction(…) but is there a cleaner way to do a multiple X axis in plotly using R? Do I have to convert from ggplot? The documentation is relatively sparse, Please don’t link the multiple Y axis example as that hasn’t helped.

Thank you thank you! 💰
