hrbrmstr / metricsgraphics

:chart_with_upwards_trend: htmlwidget interface to the MetricsGraphics.js D3 chart library
http://hrbrmstr.github.io/metricsgraphics/
Other
132 stars 35 forks source link

mjs_point does not utilize point_size argument #32

Open jrounds opened 9 years ago

jrounds commented 9 years ago

Look at the source of mjs_point the fact it does not utilize point_size object is obvious (unused).

johnpauls commented 9 years ago

+1 the points are quite small which makes this not very appealing for scatter plots.

hrbrmstr commented 9 years ago

I'll poke but they do in fact resize:

image

but this may also be an enhancement that the parent JS lib did not have in the first cpl versions (there are other new params I hope to add soon as well)

johnpauls commented 9 years ago

Thanks for the quick reply. I could not get them to resize when a size was set to a constant (e.g.15) in mjs_points via the point_size= argument. I am using version 0.8.5

jrounds commented 9 years ago

The R code in the package literally doesn't touch the point_size function argument (or didn't at the time I investigated the issue). The points can be resized, but not with the point_size argument because of the fact that it doesn't get used at all.

On Tue, Sep 8, 2015 at 12:49 PM, John Paul Schmit notifications@github.com wrote:

Thanks for the quick reply. I could not get them to resize when a size was set to a constant (e.g.15) in mjs_points via the point_size= argument. I am using version 0.8.5

— Reply to this email directly or view it on GitHub https://github.com/hrbrmstr/metricsgraphics/issues/32#issuecomment-138681161 .

jrounds commented 9 years ago

This is what I meant. This is the source code:

mjs_point <- function(mjs, point_size=2.5, least_squares=FALSE, size_accessor=NULL, color_accessor=NULL, color_type="number", color_range=c('blue', 'red'), size_range=c(1, 5), x_rug=FALSE, y_rug=FALSE) {

if (!color_type %in% c("category", "number")) { stop("'color_type' must be either 'category' or 'number'") }

mjs$x$chart_type <- "point" mjs$x$least_squares<- least_squares mjs$x$x_rug <- x_rug mjs$x$y_rug <- y_rug if (class(substitute(size_accessor)) != "NULL") { size_accessor <- substitute(size_accessor) if (inherits(size_accessor, "name")) { size_accessor <- as.character(size_accessor) } mjs$x$size_accessor <- size_accessor } if (class(substitute(color_accessor)) != "NULL") { color_accessor <- substitute(color_accessor) if (inherits(color_accessor, "name")) { color_accessor <- as.character(color_accessor) } mjs$x$color_accessor <- color_accessor } mjs$x$color_type <- color_type mjs$x$color_range <- color_range mjs$x$size_range <- size_range mjs$x$geom <- "point" mjs }

Scan it carefully. Note how the "point_size" argument never gets utilized. You could take it off the function call--it never gets utilized.

hrbrmstr commented 9 years ago

Thx. that was prbly something that got whacked in error. I'll try to get it cranked out this week.

On Tue, Sep 8, 2015 at 3:57 PM, jrounds notifications@github.com wrote:

This is what I meant. This is the source code:mjs_point <- function(mjs, point_size=2.5, least_squares=FALSE, size_accessor=NULL, color_accessor=NULL, color_type="number", color_range=c('blue', 'red'), size_range=c(1, 5), x_rug=FALSE, y_rug=FALSE) {

if (!color_type %in% c("category", "number")) { stop("'color_type' must be either 'category' or 'number'") }

mjs$x$chart_type <- "point" mjs$x$least_squares<- least_squares mjs$x$x_rug <- x_rug mjs$x$y_rug <- y_rug if (class(substitute(size_accessor)) != "NULL") { size_accessor <- substitute(size_accessor) if (inherits(size_accessor, "name")) { size_accessor <- as.character(size_accessor) } mjs$x$size_accessor <- size_accessor } if (class(substitute(color_accessor)) != "NULL") { color_accessor <- substitute(color_accessor) if (inherits(color_accessor, "name")) { color_accessor <- as.character(color_accessor) } mjs$x$color_accessor <- color_accessor } mjs$x$color_type <- color_type mjs$x$color_range <- color_range mjs$x$size_range <- size_range mjs$x$geom <- "point" mjs }

Scan it carefully. Note how the "point_size" argument never gets utilized.

— Reply to this email directly or view it on GitHub https://github.com/hrbrmstr/metricsgraphics/issues/32#issuecomment-138682903 .