Monochrome theme

For publication purposes, I am interested to create a monochrome plots. In particular, how could I implement a monochrome theme in Plots (or in any other package) , similar to the Monochrome theme of Mathematica?

Use one of the monochromatic palettes as described on ColorSchemes · Plots.

For example:

julia> function f(x, y)
           r = sqrt(x^2 + y^2)
           return r
       end
f (generic function with 1 method)

julia> x = range(-10, 10, length = 30)
-10.0:0.6896551724137931:10.0

julia> heatmap(x, x, f, c = :grays)

heat

Thanks for your recommendation.

However, this solution does not fit into my needs. I am plotting two linear functions. When I use one of the gray palettes you mention the result is that either the color of one function is white, or both two functions have quite the same color.

Also, Mathematica’s monochrome theme is different. The first line is straight, the second is dashed, the third is dotted, and so on…

For a specific subset of (for example) the grays gradient, see the colorpalette section of the page linked above, or define your own palette with a vector of colors.

I would imagine you can then edit the style of each series with :linestyle as seen here. I’m not entirely sure how to do that for a set of series, but it’s probably just a vector of symbols.

If you wanted to collect all of that together into a theme you could use on multiple plots, you could define your own theme, as seen here. I don’t think that would take much effort, the framework there is really quite nice! I think a PR for that theme if you put some work into it would be appreciated by the Plots.jl team too.

1 Like

This theme is definitely something that would be nice to have. I can see you’ve opened an issue on PlotThemes that unfortunately received no traffic.
Just for what you are doing there, how does linecolor = :black, linestyle = :auto work?

1 Like

thanks, i will give it a try asap