# Gadfly - subplot\_grid is not readjusting the x axis width for free\_x\_axis = true, if xlabels are different in subplots

**URL:** <https://discourse.julialang.org/t/gadfly-subplot-grid-is-not-readjusting-the-x-axis-width-for-free-x-axis-true-if-xlabels-are-different-in-subplots/80950>\
**Category:** Visualization\
**Tags:** gadfly\
**Created:** [May 12, 2022, 11:03am UTC](https://discourse.julialang.org/t/gadfly-subplot-grid-is-not-readjusting-the-x-axis-width-for-free-x-axis-true-if-xlabels-are-different-in-subplots/80950 "2022-05-12T11:03:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkmalaiya](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rkmalaiya/32/31236_2.png) [@rkmalaiya](https://discourse.julialang.org/u/rkmalaiya)\
**Post date:** [May 12, 2022, 11:03am UTC](https://discourse.julialang.org/t/gadfly-subplot-grid-is-not-readjusting-the-x-axis-width-for-free-x-axis-true-if-xlabels-are-different-in-subplots/80950/1 "2022-05-12T11:03:04Z")

</div>

Hello,

This issue is related to using subplot\_grid in Gadfly. The issue is, given the xlabels in the two subplots are different due to my data points, even when I do free\_x\_axis = true, the plot retains the locations of the xlabels filled with empty space. Please help me understand how may I fix this?

**Fake Data**

> df\_plot = vcat(  
> DataFrame(model = repeat([“one”,“two”, “three”],inner=242),  
> type = repeat([“type1”],outer=726),  
> data=rand(726))  
> ,  
> DataFrame(model = repeat([“four”, “five”, “six”],inner=242),  
> type = repeat([“type2”],outer=726),  
> data=rand(726)))

![image](https://global.discourse-cdn.com/julialang/original/3X/e/2/e22a9be2493568436e05017eaa40da6622657fa1.png)

_Some more information about the data_  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/7/b/7b39b4ce5ac09736458fbb430910eb85b1ae4f0f.png)

**Plot**  
Here I am _not_ using free\_x\_axis = true just to show how the plot looks

> Gadfly.plot(df\_plot,  
> x=:model,  
> y=:data,  
> xgroup = :type,  
> Geom.subplot\_grid(Geom.boxplot),  
> )
> 
> ![image](https://global.discourse-cdn.com/julialang/original/3X/a/0/a02ea584a26b5812a66e10cfa693bd8d645bf423.png)

Now, if I use free\_x\_axis = true, the empty xlabels goes away, but the empty space still remains. Hence, the plot doesn’t look pretty

 ![image](https://global.discourse-cdn.com/julialang/original/3X/d/4/d43b4fa294d348be3a481e83ac6051a99cc6ec35.png)

Thanks for all the help!
