Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stroke and Stroke Color #1268

Closed
neilpanchal opened this issue Mar 31, 2019 · 4 comments
Closed

Stroke and Stroke Color #1268

neilpanchal opened this issue Mar 31, 2019 · 4 comments

Comments

@neilpanchal
Copy link

neilpanchal commented Mar 31, 2019

Hello,

I just tried to find a way to change the outline or border color of a point. In the Themes section of the help menu, this option is disguised under discrete_highlight_color. The most common name for border or outline color is "stroke". It is used in Illustrator, Matlab, Matplotlib, etc...

What is the rationale behind discrete_highlight_color nomenclature? I think it should be called "stroke_color" or simply "stroke".

Also the description is confusing: "Color used to outline plot geometry. This is a function that alters (e.g. darkens) the fill color of the geometry. (Function)". First part is talking about "outline of the plot geometry" and then it says "alters the fill color of the geometry". stroke and fill have specific meanings in semiological representation so I think the description should be altered. I am curious if there are other reasons for naming it in a particular way.

@Mattriks
Copy link
Member

I agree that the description should be changed to stroke.

I don't know the answer for your q. about using _highlight_color vs. _stroke_color, and that might require the original creator (he sometimes reappears).

Did you notice that stroke_color appears in the list of Theme options (it's option 36), but without explanation (some text should be added). There are comment lines here, and an example here (2nd code block).

@neilpanchal
Copy link
Author

@Mattriks Yea, it does seem apply to error bars only.

Here is an example from R's ggplot2 library:
https://ggplot2.tidyverse.org/reference/geom_point.html

Stroke is used to modify the width of the border but not color.

There is a great example at the bottom:

p + geom_point(colour = "black", size = 4.5) +
  geom_point(colour = "pink", size = 4) +
  geom_point(aes(shape = factor(cyl)))

image

I like this better!

@neilpanchal neilpanchal changed the title discrete_highlight_color - Change to "stroke_color" Stroke and Stroke Color Apr 1, 2019
@Mattriks
Copy link
Member

Mattriks commented Apr 1, 2019

You can do the same in Gadfly:

using RDatasets
mtcars = dataset("datasets", "mtcars")

theme(color,size)= Theme(default_color=color, point_size=size, discrete_highlight_color=identity)

plot(mtcars, x=:MPG, y=:WT, shape=:Cyl, Geom.point,
    layer(Geom.point,  theme("pink", 4pt)),
    layer(Geom.point, theme("black", 4.5pt)),
    Scale.shape_discrete(levels=[4,6,8]),
    Theme(key_swatch_color="pink", default_color="black")
)

@Mattriks
Copy link
Member

With recent improvements to Gadfly e.g. keys (soon to be tagged #1378), here is an update of this plot.
I use push_theme first because this makes it easy to Theme several plots.

Gadfly.push_theme(
 Theme(default_color="pink", discrete_highlight_color=c->"black", point_size=4.5pt,
    panel_fill="gray92", grid_color="white", grid_line_style=:solid)
)

plot(mtcars, x=:MPG, y=:WT, shape=:Cyl,
    layer(style(default_color=colorant"black", point_size=1pt)),
    layer(), Scale.shape_discrete(levels=[4,6,8])
)

iss1268

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants