How to change the yaxis linecolor in the horizontal bar?

I want to change the yaxis linecolor to white,the yaxis linecolor is effect, but the line link two bar is black ,anyone can help me ? thanks

see following code:

p %>%
layout(title = “horn bar Charts with label”,
titlefont =list(color=‘red’,size=12),
titleside =‘bottom’,
xaxis=list(title=‘人数’,
showgrid=F,
side=‘bottom’,

              nticks=10,
              ticks='inside',
              ticksuffix='人',
              tickfont=list(color='blue')),
   yaxis=list(title='',
              showgrid=F,
              #type="category" ,
              #ticks='inside',
              #color='white',
              linecolor='red',
              zeroline=F,
              #showline=FALSE,
              showticklabels=FALSE
              #mirror='all',
              ))

Could you clarify what you mean by link two bar ?

thanks,I mean, I use the following code in the layout function:

yaxis=list(title=’’,
showgrid=F,
color=‘white’,
linecolor=‘white’,
showticklabels=FALSE
))

OR

yaxis=list(title=’’,
showgrid=F,
showline=FALSE,
showticklabels=FALSE
))

but the part color of yaxis is still black (you Look the following picture carefully, between two bar)

I think the black line between bars is not the yaxis, so the parameter for yaxis is not take effect. but What the heck’s that?

all code is following:

library(plotly)
p <- plot_ly(
y = c(“giraffes”, “orangutans”, “monkeys”,‘girl’),
x = c(20, 14, 23,1),
name = “SF Zoo”,
type = “bar”,
orientation =“h”,
line=list(color=‘white’),
text=y,
hoverinfo=‘x+text’,
#hoveron=‘points+fills’,
marker = list(color = c(“orange”,“blue”,“green”,‘skyblue’)))
p %>%
layout(title = “horn bar Charts with label”,
titlefont =list(color=‘red’,size=12),
titleside =‘bottom’,
xaxis=list(title=’’,
showgrid=F,
side=‘bottom’,
#nticks=10,
#ticks=‘inside’,
ticksuffix=‘人’,
tickfont=list(color=‘blue’)),
yaxis=list(title=’’,
showgrid=FALSE,
#type=“category” ,
#ticks=‘inside’,
#color=‘red’,
#linecolor=toRGB(‘red’),
zeroline=FALSE,
#zerolinecolor = toRGB(“red”),
showline=FALSE,
showticklabels=FALSE
#mirror=‘all’,
))

in the end,I find the another question, the titleside is not take effect, how to change the title position?
https://plot.ly/r/reference/
thanks a lot!

it’s zeroline -> https://plot.ly/r/reference/#layout-xaxis-zeroline

1 Like

you are right, cool, thanks very much!!
I add the
zeroline=FALSE
to the xaxis, the black line is disappear,
why xaxis,not yaxis?:sweat:

Good question. zeroline refers to the q=0 grid line where q is either x or y. So removing the vertical zero line corresponds to removing the x=0 grid line.

greatly appreciate,I konw that now!
I have another question about the titleside parameter,I add
titleside='bottom’
to layout function,but not take effect,could you tell me how to change the title position?
thanks!

titleside isn’t a plotly option at the moment. In fact, there’s no way to change the title position at all currently.

I’d recommend using paper-referenced annotations for more custom-looking titles.