Git Product home page Git Product logo

Comments (10)

Atan1988 avatar Atan1988 commented on May 22, 2024 1

Is it possible to format the number as percentages? I generally use sprintf for stuff like that, and I am not aware how to do it using format().

Thanks,
Allen

from treemap.

mtennekes avatar mtennekes commented on May 22, 2024

Isn't this already implemented in the argument legend.format, or do you still miss certain functionalities?

from treemap.

mtennekes avatar mtennekes commented on May 22, 2024

I was having tmap in mind, sorry:)
Indeed, it's not in treemap yet. Please feel free to push a request.

from treemap.

ellisp avatar ellisp commented on May 22, 2024

I've lodged #32 to address this. I see I have rights to merge it myself (I think this dates from years ago when you gave me those rights for additions re fonts), but I've refrained from doing this until I have @mtennekes views on the naming, and whether it's right to pass it only to dens2col and val2col legends (nearly all my treemaps are type "value" so I'm a bit hazy on the best treatment of the other types).

from treemap.

mtennekes avatar mtennekes commented on May 22, 2024

Many thanks @ellisp ! The implementation seems correct to me. The value, density and manual treemaps are indeed the ones that could use formatting. As for the other ones: comparison does not need it since it contain percentages, and the others do not have numeric values.

I have updated the https://github.com/mtennekes/treemap/blob/a67993a8b154b0de525fb89b9969de376e54ef86/pkg/DESCRIPTION file. Is you email address correct? Do you want me to release it soon? Normally, I wait under there are at least a couple of changes.

from treemap.

ellisp avatar ellisp commented on May 22, 2024

Great, thanks. I changed the email address to my personal one; sometimes difficult to tell which hat I'm wearing, but this one was done at home in my time so probably best to put it like that (although we need it at work). No rush to put it into production at CRAN, put out a release when it makes sense.

from treemap.

ellisp avatar ellisp commented on May 22, 2024

@Atan1988 I don't think it will let you do that. That would be another feature to add I think; either to replace format with `sprintf`` (which would not be backwards compatible with #32 so if it's going to happen should ideally be soon) or additional arguments "suffix.legend" and "prefix.legend". As a user I'd find the latter slightly easier to understand but it comes with extra arguments and loss of flexibility.

from treemap.

Atan1988 avatar Atan1988 commented on May 22, 2024

@ellisp Peter, thank you for the response and the great work in implementing the format function. I know R fairly well, but I haven't learned how to use git yet. Would you have time to implement the sprinf function? If not, would you be willing to help with the pull/commit side of the things, if I take a shot at modifying the code? Thanks a lot! Allen

from treemap.

mtennekes avatar mtennekes commented on May 22, 2024

It's really confusing, all those formatting functions: format, sprintf, formatC, prettyNum :-s

As @ellisp suggested, we can add suffix and prefix to the input list of format.legend (while the other arguments are passed on to format). Additionally, we can add another list argument, called FUN, which determines to which formatting function is used (by default format).

from treemap.

benjaminrobinson avatar benjaminrobinson commented on May 22, 2024

Was looking through the issue statement and the percentage issue is something that would be really helpful for me...just my two cents. Thanks for creating the package!

from treemap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.