Giter VIP home page Giter VIP logo

Comments (15)

jrnold avatar jrnold commented on May 17, 2024
  1. Thanks!
  2. It might have been good if I had done that to begin with, but now I don't want to break any existing code by changing it. You can get around this by always using base_size as a named argument
theme_wsj(base_size = 20)
theme_stata(base_size = 20)

from ggthemes.

ptoche avatar ptoche commented on May 17, 2024

No problem, it was just a thought.

The simplest would have been to change line 239 from:

theme_stata <- function(scheme="s2color", base_size = 11, base_family = "sans") {

to:

theme_stata <- function(base_size = 11, scheme="s2color", base_family = "sans") {

That would break if anyone is calling the function like this: theme_stata("s2color", 12, "sans") but you could have an if numeric check to see if the font size is being passed first or second, which would make the code backward-compatible. Anyway, just a thought. Cheers!

from ggthemes.

jrnold avatar jrnold commented on May 17, 2024

It would be easy to change, but I still don't see the need to. If there's a lot of complaints I'd reconsider. If I were to change it, I'd deprecate the entire theme_stata function and make each scheme a separate theme, e.g. theme_stata_s2color, etc. I think I originally had scheme as a required argument, and only later made it optional.

In general, i don't like the style of correcting a user's "mistakes" by guessing their intent. The function should check for correctness and and throw an error if its wrong. Trying to correct for the user's intent results in lots of uncaught logical bugs which are even harder to track down than responding to an explicit error message.

from ggthemes.

ptoche avatar ptoche commented on May 17, 2024

Sure, it's not a problem. The last point was not to correct a user 'mistake' but to make it possible to use the theme_stata() function in the same way as theme_bw() from ggplot2 and in the same way as you wrote it. Enough said. Thanks and cheers for now.

from ggthemes.

jrnold avatar jrnold commented on May 17, 2024

You're right that I should have been more consistent in the ordering of the arguments in the themes, and I'm kicking myself for not doing that in the first place. I just don't think it's big enough to break any existing code of other people (to whatever extent anyone is using it). But it's in my head now, so maybe my opinion will change. Thanks again!

from ggthemes.

ptoche avatar ptoche commented on May 17, 2024

Oh please don't kick yourself, it never was worth the long comments I made. I enjoy ggthemes very much. I used to spend a lot of time tweaking styles, but now I'll just pull one style from your existing ones. (to me the main point of using theme_stata() is to show Stata users they can easily switch to R!)

from ggthemes.

jrnold avatar jrnold commented on May 17, 2024

Rethought this one. Since it was always optional, option order wasn't guaranteed.

from ggthemes.

ptoche avatar ptoche commented on May 17, 2024

👍 👍 👍

from ggthemes.

ptoche avatar ptoche commented on May 17, 2024

I noticed theme_solid() also has a different order of options. The effect of theme_solid(20) is not error but to pass the option to fill with the result that the background color changes to blue.

from ggthemes.

jrnold avatar jrnold commented on May 17, 2024

Hmm, on one hand since the font family and font sizes are ignored, there shouldn't be any options. But if it is used as a parent theme, they should exist.

from ggthemes.

ptoche avatar ptoche commented on May 17, 2024

Another comment in passing, of utmost triviality, you have named two files theme-foundation.R and theme-solid while the other theme files are named e.g. tufte.R. Perhaps it will be easier to read the code if you name everything like the function, e.g. theme_solid.R, theme_tufte.R, etc.. Makes it easier to find your way around the R directory.

from ggthemes.

jrnold avatar jrnold commented on May 17, 2024

I looked at theme_solid, and it makes no sense to include parameters that aren't used and in fact wouldn't be inherited. I'd rather throw an error than have those ignored.

from ggthemes.

jrnold avatar jrnold commented on May 17, 2024

I just use grep :-)

from ggthemes.

jrnold avatar jrnold commented on May 17, 2024

Rethought my rethinking. Made it so that base_size and base_family are the 1st two arguments to all user-facing theme_* functions. But, it's still good and safe style to always use argument names for all optional arguments.

from ggthemes.

ptoche avatar ptoche commented on May 17, 2024

agreed about throwing an error! Thanks for your hard work 👍 👍 👍

from ggthemes.

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.