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

Add Gadfly.Scale.linestyle_discrete_manual() ? #1406

Closed
frankwswang opened this issue Mar 26, 2020 · 2 comments
Closed

Add Gadfly.Scale.linestyle_discrete_manual() ? #1406

frankwswang opened this issue Mar 26, 2020 · 2 comments

Comments

@frankwswang
Copy link

Is it possible to add this function in the future?

Gadfly.Scale.linestyle_discrete_manual(styles...; levels=nothing, order=nothing)

Because sometimes I find the default arrangement of line styles may not fit well for certain shapes of lines.

Thank you.

@Mattriks
Copy link
Member

The palette for discrete scales can be changed using Theme, see the Tutorial.
For line styles, the default palette is Theme().line_style. Custom line styles are possible:

using Compose, DataFrames, Gadfly, RDatasets

D = dataset("ggplot2", "economics")
Dl = stack(D[:, [1,2,6]],  Not(:Date))

# Example of a custom line style palette
lstyle = [[1, 1].*3.0mm, [5, 2, 3, 2].*2.0pt]

 p = plot(Dl, x=:Date, y=:value, color=:variable, linestyle=:variable,
    Geom.line, Scale.y_log10, 
#     Theme(line_style=[:dot, :dash])
    Theme(line_style=lstyle)
)

linestyle

@frankwswang
Copy link
Author

Thank you! This is very helpful!

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