# How to set the default value of y- axis or any value as a default for the first plot

**URL:** https://community.plotly.com/t/how-to-set-the-default-value-of-y-axis-or-any-value-as-a-default-for-the-first-plot/6291
**Category:** Plotly R
**Created:** [October 14, 2017, 1:45am UTC](https://community.plotly.com/t/how-to-set-the-default-value-of-y-axis-or-any-value-as-a-default-for-the-first-plot/6291 "2017-10-14T01:45:20Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Nrnjn\_adhikari](https://avatars.discourse-cdn.com/v4/letter/n/e9a140/32.png) [@Nrnjn\_adhikari](https://community.plotly.com/u/Nrnjn_adhikari)
#### Post date: [October 14, 2017, 1:45am UTC](https://community.plotly.com/t/how-to-set-the-default-value-of-y-axis-or-any-value-as-a-default-for-the-first-plot/6291/1 "2017-10-14T01:45:20Z")

</div>

I have plotted the the 5 major cities temperature values, but it print like blank. I would like to set the Melbourne temperature as a default values. Can you help me out please. I have attached my interactive version here. ![First_Plot](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/c/cb91314634bd1a6c061f4de21cc0ec29b1bc28ee.jpg) [https://plot.ly/~Nrnjn\_adhikari/23/](https://plot.ly/~Nrnjn_adhikari/23/)

p2 \<- plot\_ly(data = temp\_data) %\>%

add\_lines(x=~Date, y=~Melbourne, name = “Melbourne”, visible = “legendonly”) %\>%  
add\_lines(x=~Date, y=~Sydney, name = “Sydney”, visible = “legendonly”) %\>%  
add\_lines(x=~Date, y=~Perth, name = “Perth”, visible = “legendonly”) %\>%  
add\_lines(x=~Date, y=~Darwin, name = “Darwin”, visible = “legendonly”) %\>%  
add\_lines(x=~Date, y=~Adelaide, name = “Adelaide”, visible = “legendonly”) %\>%

layout(title = “Australian Major Cities Temperature Time Series”, showlegend=TRUE,  
xaxis=list(zeroline = FALSE,title=“Date”, rangeslider = list(type = “date”)),  
yaxis=list(zeroline = FALSE,title=“Temperature (Celsius)”),  
updatemenus=updatemenus)

p2

---

<div class="post-metadata">

### Author: ![bcd](https://avatars.discourse-cdn.com/v4/letter/b/ec9cab/32.png) [@bcd](https://community.plotly.com/u/bcd)
#### Post date: [October 16, 2017, 3:03pm UTC](https://community.plotly.com/t/how-to-set-the-default-value-of-y-axis-or-any-value-as-a-default-for-the-first-plot/6291/2 "2017-10-16T15:03:56Z")

</div>

Hey @Nrnjn_adhikari

Consider using / changing `active` and `showactive` attributes in updatemenus [https://plot.ly/r/reference/#layout-updatemenus-active](https://plot.ly/r/reference/#layout-updatemenus-active)

---

<div class="post-metadata">

### Author: ![Nrnjn\_adhikari](https://avatars.discourse-cdn.com/v4/letter/n/e9a140/32.png) [@Nrnjn\_adhikari](https://community.plotly.com/u/Nrnjn_adhikari)
#### Post date: [October 17, 2017, 9:12am UTC](https://community.plotly.com/t/how-to-set-the-default-value-of-y-axis-or-any-value-as-a-default-for-the-first-plot/6291/3 "2017-10-17T09:12:07Z")

</div>

Hi @bcd, Thank you very much for your response. I could not get fix it yet. I have attached my update menus here. Can you please check this one. I will truly appreciate your time and effort.

updatemenus \<- list(  
list(  
active = 0,  
x = -.125,  
type= ‘buttons’,  
buttons = list(  
list(  
label = “Melbourne”,  
method = “update”,  
args = list(list(visible = c(TRUE, “legendonly”, “legendonly”,  
“legendonly”, “legendonly” )))),  
list(  
label = “Sydney”,  
method = “update”,  
args = list(list(visible = c(“legendonly”, TRUE, “legendonly”,  
“legendonly”, “legendonly”)))),  
list(  
label = “Perth”,  
method = “update”,  
args = list(list(visible = c(“legendonly”, “legendonly”, TRUE,  
“legendonly”, “legendonly”)))),  
list(  
label = “Darwin”,  
method = “update”,  
args = list(list(visible = c(“legendonly”, “legendonly”, “legendonly”,  
TRUE, “legendonly”)))),  
list(  
label = “Adelaide”,  
method = “update”,  
args = list(list(visible = c(“legendonly”, “legendonly”, “legendonly”,  
“legendonly”, TRUE))))  
)  
)  
)

---

<div class="post-metadata">

### Author: ![Nrnjn\_adhikari](https://avatars.discourse-cdn.com/v4/letter/n/e9a140/32.png) [@Nrnjn\_adhikari](https://community.plotly.com/u/Nrnjn_adhikari)
#### Post date: [October 20, 2017, 11:03pm UTC](https://community.plotly.com/t/how-to-set-the-default-value-of-y-axis-or-any-value-as-a-default-for-the-first-plot/6291/4 "2017-10-20T23:03:58Z")

</div>

Now, problem has been resolved 🙂 when I deleted the legendonly inside the add\_lines.  
I have changed the single code in inside the plot object, this is corrected line  
add\_lines(x=~Date, y=~Melbourne, name = “Melbourne”) %\>%

Cheers
