Question: I am trying to get the request header in a mojolicious template. I need to get a custom header. In Flask I would use

```
{{request.headers['customheader] }}

```

How do I achieve the same in Mojolicious? There is a `Mojo::Message::Request` package.

So are what I have isn't working.

```
% use Mojo::Message::Request;
% my $req = Mojo::Message::Request->new;
<%= $req->headers->header('customheader') %>

```

If I only print `$req` I get a giant hash.
I have also tried to use

```
% use Mojo::Headers;
% my $headers = Mojo::Headers->new;
<%= $headers->parse('X-Forwarded-For') %>

```

Answer: 
If you just want to show a second x-axis (without plotting anything on it) it may be easier with a [scondary axis](https://matplotlib.org/3.1.1/gallery/subplots_axes_and_figures/secondary_axis.html#sphx-glr-gallery-subplots-axes-and-figures-secondary-axis-py). You'll have to change the [`functions`](https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.axes.Axes.secondary_xaxis.html?highlight=secondary_x#matplotlib-axes-axes-secondary-xaxis) as needed:

```
import matplotlib.pyplot as plt
import numpy as np 

y = np.random.rand(41*8)

fig,ax = plt.subplots()
ax.set_xticks(np.arange(0,41*8,5*8))
xticklabels = [str(x) for x in range(0, 41, 5)]
ax.set_xticklabels(xticklabels)

secx = ax.secondary_xaxis('top', functions=(lambda x: x/8, lambda x: x/8))

ax.plot(y)
plt.show()

```

[![enter image description here](https://i.stack.imgur.com/HRsdY.png)](https://i.stack.imgur.com/HRsdY.png)

---

I assume that the problem with `twiny` is due to the absence of data on the new Axes, but
I didn't manage to get it working, even after manually setting the data interval.

---

**Update as per comment and edited question**:

```
secx = ax.secondary_xaxis('top', functions=(lambda x: 5*x/8-50, lambda x: 5*x/8-50))
secx.set_xticks([0,25,50,75,100])
secx.set_xticklabels([f'{x}' for x in secx.get_xticks()])

```

[![enter image description here](https://i.stack.imgur.com/xF1Og.png)](https://i.stack.imgur.com/xF1Og.png)
Ok my workaround now was simply plotting the data with the second axis without color.

```
import matplotlib.pyplot as plt
import numpy as np 

fig,axs = plt.subplots()

xticklabels = [str(x) for x in range(0, 40+1, 5)]
y = np.random.rand(41*8)

axs.set_xticks(np.arange(0,41*8,5*8))
axs.set_xticklabels(xticklabels)
ax0 = axs.twiny()

ax0.set_xticks(np.arange(10*8,31*8,5*8))
ax0.set_xticklabels(["0", "25", "50", "75", "100"])
axs.plot(y)
ax0.plot(y, color ="None")

plt.show()

```