这是indexloc提供的服务,不要输入任何密码
Skip to content

Fixed breaks in a map #1030

@nickbearman

Description

@nickbearman

Hi,

Sorry this is a long rambly post. In short, I think the help needs a fixed breaks example. I suggest adding it to tm_polygons help - does this make sense, or is there a better place?

I have been trying to create a map with fixed breaks.

This code works:

tm_shape(World) +
  tm_symbols(fill = "well_being", fill.scale = tm_scale(breaks = c(2,4,6,10)))

And if we want to specify colour etc we can pad out to this:

  tm_symbols(fill = "well_being", fill.scale = tm_scale_intervals(values = "brewer.greens", 
    n = 6, 
    style = "fixed",
    breaks = c(2,4,6,10)))

However I think the help needs clarifying.

Under help for tm_scale_intervals is says for style:

Method to create intervals. Options are "cat", "fixed", "sd", "equal", "pretty", "quantile", "kmeans", "hclust", "bclust", "fisher", "jenks", "dpih", "headtails", and "log10_pretty". See the details in classInt::classIntervals() (extra arguments can be passed on via style.args).

Ok, fine.

Here I wasn't paying attending, and looked at classInt::classIntervals() which is not part of tmap, but I didn't realise that at the time.

That uses plot(classIntervals(jenks71$jenks71, n=5, style="fixed", fixedBreaks=c(15.57, 25, 50, 75, 100, 155.30)), pal=pal1, main="Fixed") as a fixed example so I was trying to work with fixedBreaks rather than breaks.

So I think we need a fixed breaks example somewhere. Is in the help under ?tm_polygons the best place? Or somewhere else?

Thanks!
Nick.

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