-
Notifications
You must be signed in to change notification settings - Fork 632
Closed
Description
The code below is based this example plotting world GDP.
It attempts to modify the colorbar using x
, y
, and len
arguments.
The x
argument has an effect and moves the colorbar horizontally. y
and len
have no impact, so the vertical position and length cannot be altered.
library(plotly)
df <- read.csv('https://raw.githubusercontent.com/plotly/datasets/master/2014_world_gdp_with_codes.csv')
# specify map projection/options
g <- list(
showframe = FALSE,
showcoastlines = TRUE,
projection = list(type = 'Mercator')
)
p <- plot_geo(df, locationmode = 'country names') %>%
add_trace(
z = ~GDP..BILLIONS., color = ~GDP..BILLIONS., colors = 'Blues',
locations = ~COUNTRY
) %>%
colorbar(title = 'GDP Billions US$',
x = 0.5,
len = 0.1,
y = 0.1
) %>%
layout(
geo = g,
margin = list(l=0, r=0, t=0, b=0, pad=0)
)
print(p)
Metadata
Metadata
Assignees
Labels
No labels