Giter Site home page Giter Site logo

styles's Introduction

styles

The goal of styles is to create and apply ggplot-style themes to base plots.

Installation

You can install styles from github with:

# install.packages("devtools")
devtools::install_github("lizhmartin/styles")

Example

This is a basic example which shows you how to solve a common problem:

library(styles)

# plot with internal style
plot_mat <- matrix(1:8, nrow = 2, byrow = FALSE)
layout(plot_mat)

example_plots()

style(better)
example_plots()

remove_style()
par(mfrow=c(1,1))

# create a new style:
blue <- new_style(graphics = list(plot.xy = list(col = "navyblue")))
style(blue)
plot(mpg ~ wt, data = mtcars)

remove_style()

blue_stars <- new_style(par = list(pch = 8),
                  graphics = list(plot.xy = list(col = "navyblue")))
style(blue_stars)
plot(mpg ~ wt, data = mtcars)

remove_style()

###

styles's People

Stargazers

John MacKintosh avatar Krzysztof Joachimiak avatar Lovenish Gaur avatar Thomas Neitmann avatar John Blischak avatar Liuyong Ding avatar Ryan Holbrook avatar  avatar Matt Dray avatar Pol Cuscó avatar Matthew Henderson avatar Michael Sumner avatar Nick Golding avatar Nicholas Tierney avatar

Watchers

Nick Golding avatar  avatar

styles's Issues

Error in default(fun) <- value : could not find function "default<-"

Hi,

I get the following errors when I try to run the example code.

> library(styles)
> # plot with internal style
> plot_mat <- matrix(1:8, nrow = 2, byrow = FALSE)
> layout(plot_mat)
> example_plots()
> style(better)
Error in default(fun) <- value : could not find function "default<-"
> example_plots()
> library(styles)
> # plot with internal style
> plot_mat <- matrix(1:8, nrow = 2, byrow = FALSE)
> layout(plot_mat)
> example_plots()
> style(better)
Error in reset_default(fun) : could not find function "reset_default"

I think this is just a symptom of those functions belonging to the default package so either the user has to do library(default) every time they use styles or the functions in the default package need to be imported by styles. I'll submit a PR with one possible fix (adding default:: to every function call).

Thanks,
Matthew

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.