Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Horizontal grid lines in plotly R

Tags:

r

plotly

The standard R plotly scatter/line graph comes with both vertical and horizontal grid lines. I cannot find the command to select only vertical or horizontal lines. I want the latter. So far I have found the following commands in the offiial guide:

showgrid = FALSE/TRUE
gridcolor = ...
gridwidth = ...

Any idea which is the command to select subset of grid lines?

like image 939
luchonacho Avatar asked Nov 21 '16 12:11

luchonacho


People also ask

How do you remove gridlines in Plotly?

How do you remove gridlines in Plotly? Toggling Axis grid lines Axis grid lines can be disabled by setting the showgrid property to False for the x and/or y axis. Here is an example of setting showgrid to False in the graph object figure constructor.

Can Plotly be used in R?

Plotly is a free and open-source graphing library for R. We recommend you read our Getting Started guide for the latest installation or upgrade instructions, then move on to our Plotly Fundamentals tutorials or dive straight in to some Basic Charts tutorials.


1 Answers

Edit: The showline argument is indeed for the axes. showgrid should work for the gridlines, called within each axis agrument in layout().

plot_ly(x = c(1,2), y = c(1,2)) %>%
  layout(xaxis = list(showgrid = FALSE),
         yaxis = list(gridcolor = "black"))

enter image description here

like image 173
Vance Lopez Avatar answered Sep 24 '22 17:09

Vance Lopez