Skip to content

Choropleth colorbar y and len arguments have no effect. #1137

@jakehoare

Description

@jakehoare

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions