Library ( plotly ) data ( iris ) fig % group_by ( Species ) %>% do ( p = plot_ly (. , x = ~ Sepal.Width, y = ~ Sepal.Length, type = "scatter", opacity = 0.5, mode = "markers", marker = list ( color = "blue" ))) %>% subplot ( nrows = 1, shareX = TRUE, shareY = TRUE ) fig % layout ( annotations = list ( list ( x = 0.16, y = 1, font = list ( size = 10 ), text = "species=setosa", xref = "paper", yref = "paper", xanchor = "center", yanchor = "bottom", showarrow = FALSE ), list ( x = 0.5, y = 1, font = list ( size = 10 ), text = "species=versicolor", xref = "paper", yref = "paper", xanchor = "center", yanchor = "bottom", showarrow = FALSE ), list ( x = 0.85, y = 1, font = list ( size = 10 ), text = "species=virginica", xref = "paper", yref = "paper", xanchor = "center", yanchor = "bottom", showarrow = FALSE ))) %>% layout ( plot_bgcolor = '#e5ecf6', xaxis = list ( title = list ( text = 'Sepal.Width', font = list ( size = 15, family = 'Courier', color = 'crimson' )), zerolinecolor = '#ffff', zerolinewidth = 2, gridcolor = 'ffff' ), xaxis2 = list ( title = list ( text = 'Sepal.Width', font = list ( size = 15, family = 'Courier', color = 'crimson' )), zerolinecolor = '#ffff', zerolinewidth = 2, gridcolor = 'ffff' ), xaxis3 = list ( title = list ( text = 'Sepal.Width', font = list ( size = 15, family = 'Courier', color = 'crimson' )), zerolinecolor = '#ffff', zerolinewidth = 2, gridcolor = 'ffff' ), yaxis = list ( title = list ( text = 'Sepal.Length', font = list ( size = 18, family = 'Courier', color = 'crimson' )), zerolinecolor = '#ffff', zerolinewidth = 2, gridcolor = 'ffff' ), showlegend = F ) fig In the example below the automatic X axis type would be linear (because there are not more than twice as many unique strings as unique numbers) but we force it to be category. It is possible to force the axis type by setting explicitly autotypenumber.
Both of these test an evenly-spaced sample of at most 1000 values.date and category: require more than twice as many distinct date or category strings as distinct numbers in order to choose that axis type.multicategory is just a shape test: is the array nested?.First check for multicategory, then date, then category, else default to linear ( log is never automatically selected).The axis type is auto-detected by looking at data from the first trace linked to this axis: The different types of Cartesian axes are configured via the xaxis$type or yaxis$type attribute, which can take on the following values: See also the tutorials on subplots 2-D Cartesian Axis Types and Auto-Detection Other kinds of subplots and axes are described in other tutorials:
#R plot rename x axis how to#
This tutorial explain how to set the properties of 2-dimensional Cartesian axes, namely X-axis and Y-axis.
#R plot rename x axis upgrade#
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.
#R plot rename x axis free#
Plotly is a free and open-source graphing library for R. How to adjust axes properties in R - axes titles, styling and coloring axes and grid lines, ticks, tick labels and more