# Restyle Axis JS

**URL:** https://community.plotly.com/t/restyle-axis-js/3447
**Category:** plotly.js
**Created:** [February 21, 2017, 10:05pm UTC](https://community.plotly.com/t/restyle-axis-js/3447 "2017-02-21T22:05:07Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![HakanE](https://avatars.discourse-cdn.com/v4/letter/h/f04885/32.png) [@HakanE](https://community.plotly.com/u/HakanE)
#### Post date: [February 21, 2017, 10:05pm UTC](https://community.plotly.com/t/restyle-axis-js/3447/1 "2017-02-21T22:05:07Z")

</div>

I am trying to restyle a scatter plot I have with Plotly JS and I cant seem to get it working. All I need to do is to be able to switch between normal and logarithmic axes.

I can switch to log just find with something like this:  
`var update10 = { xaxis: { type: 'log', autorange: true }, }; Plotly.relayout('myDiv', update10);`

However, I can not switch back to normal axis. The autorange does not work what so ever and I am left with only the beginning portion of my data.

For example in this codepen: [http://codepen.io/anon/pen/zNgXWG?editors=1010](http://codepen.io/anon/pen/zNgXWG?editors=1010)  
If you uncomment the last relayout which sets the x-axis type to “-” which is the default, and autorange = true (also default), the range is messed up!

How do I set the axis back to normal and get the autorange to actually work? Any help is appreciated.

---

<div class="post-metadata">

### Author: ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)
#### Post date: [February 22, 2017, 11:16pm UTC](https://community.plotly.com/t/restyle-axis-js/3447/2 "2017-02-22T23:16:02Z")

</div>

Try [http://codepen.io/etpinard/pen/KWPrYZ](http://codepen.io/etpinard/pen/KWPrYZ)

Notice the different update signatures:

- in your example, you call `Plotly.relayout('graph', 'xaxis', {/* /*})`, which replace the entire `xaxis` container with a new one.
- in the codepen, `Plotly.relayout('graph', 'xaxis.type', 'log')`, only replace the axis type and gets the desired result.
